Apex Annotations In Salesforce.
Here are some commonly used Apex annotations in Salesforce.
1. @AuraEnabled:
This annotation is used to make Apex methods available for client-side access in Lightning components.
2. @TestSetup:
This annotation is used to create test records that are used across all test methods within a test class.
3. @TestVisible:
This annotation is used to make private class methods and variables available to test methods in the same or a different class.
4. @InvocableMethod:
This annotation is used to expose Apex methods to the process builder, flow builder, and the API to perform custom automation.
5. @Deprecated:
This annotation is used to mark Apex methods, variables, or classes as old and no longer used, but kept for backward compatibility.
6. @RemoteAction:
This annotation is used to expose Apex methods to be called from JavaScript on Visualforce pages.
7. @SuppressWarnings:
This annotation is used to Disable warnings for a specific class, method, or variable.
8. @ReadOnly:
This annotation is used to mark fields as read-only, nothing the field cannot be updated.
9. @Future:
This annotation is used to indicate that an Apex method runs asynchronously in a separate thread after the current transaction is completed.
10. @IsTest:
This annotation is used to mark Apex methods as test methods.
11. @HttpPut:
This annotation is used to mark Apex REST methods that accept HTTP put requests.
12. @HttpDelete:
This annotation is used to mark Apex REST methods that accept HTTP delete requests.
13. @HttpPost:
This annotation is used to mark Apex REST methods that accept HTTP post requests.
14. @HttpGet:
This annotation is used to Identify methods that accept HTTP GET requests.
15. @HttpPatch:
This annotation is used to Identify methods that accept HTTP PATCH requests.
16. @RestResource:
This annotation is used to enable you to expose an Apex class as a REST resource.
Follow Us