Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Annotations
To add an annotation to a method, specify it immediately before the method or class definition. For example:
1global class MyClass {
2 @Future
3 Public static void myMethod(String a)
4 {
5 //long-running Apex code
6 }
7}Apex supports these annotations.
- @AuraEnabled
- @Deprecated
- @Future
- @InvocableMethod
- @InvocableVariable
- @IsTest
- @JsonAccess
- @NamespaceAccessible
- @ReadOnly
- @RemoteAction
- @SuppressWarnings
- @TestSetup
- @TestVisible
- Apex REST annotations:
- @ReadOnly
- @RestResource(urlMapping='/yourUrl')
- @HttpDelete
- @HttpGet
- @HttpPatch
- @HttpPost
- @HttpPut
You can use multiple annotations for the same class or method. Specify each annotation on a separate line immediately before the class or method definition. Some annotations can’t be used together. If applicable, these limitations are documented on the page for the annotation.