Newer Version Available
Annotations
An Apex annotation modifies the way that a method or class is used, similar to
annotations in Java. Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
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 the following annotations.
- @AuraEnabled
- @Deprecated
- @Future
- @InvocableMethod
- @InvocableVariable
- @IsTest
- @ReadOnly
- @RemoteAction
- @SuppressWarnings
- @TestSetup
- @TestVisible
- Apex REST annotations:
- @RestResource(urlMapping='/yourUrl')
- @HttpDelete
- @HttpGet
- @HttpPatch
- @HttpPost
- @HttpPut