Skip to content

Instantly share code, notes, and snippets.

@kenandersen
Last active August 29, 2015 14:08
Show Gist options
  • Save kenandersen/0808a99077fc94394d3d to your computer and use it in GitHub Desktop.
Save kenandersen/0808a99077fc94394d3d to your computer and use it in GitHub Desktop.
A reference describing annotations in Salesforce's Apex language

Annotations in Apex for Salesforce.md

####Header Apex has six main types of annotations and six REST annotations. Annotations change the way a method or class is used. Annotations are denoted with an "@".

  1. @Deprecated
  • This is only used for managed packages (basically apps you install through the App Exchange).
  • It's fairly obvious, but it's used to mark a method, class, enum, etc. that can no longer be used.
  • What isn't obvious is that deprecated elements will be useable for existing subscribers and API integrations.
  • Nitty gritty rules:
    • webService methods and variables can't be deprecated.
    • You can deprecate enum but not individual enum values.
    • You cannot updeprecate once it's deprecated by releasing a package in which it is undeprecated.
    • You can deprecate an abstract class but not individual methods within a abstract class.
  1. @Future
  • This is a VERY useful annotation.
  • When included in a method, the method will execute asynchronously instead of the default synchronous execution.
  • Can help with user load times and governor limits

More to come!

######For more information reference the official Salesforce/Apex documentation.

Follow me on Twitter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment