Brane
Brane

Reputation: 3339

Using Reserved words as fields name

I am using external WSDL class for creating apex classes for my project, some of the classes have fields which name is reserved in apex, as limit word. My problem here is, i can't call that field, sample example:

System.debug(object.limit);

where limit is field in object. I can't even save the file because there is error in console saying:

Variable does not exist: limit

Any idea how reserved word in this cases can be escaped?

Upvotes: 1

Views: 1107

Answers (1)

Daniel Ballinger
Daniel Ballinger

Reputation: 13537

I've made an alternative version of Wsdl2Apex. You can get it for free from the FuseIT website.

In this alternative version it will add a _x suffix to the generated apex code for any reserved keywords that are encountered. The underlying generated SOAP request won't have this suffix.

Upvotes: 1

Related Questions