Activity › Forums › Salesforce® Discussions › What are the different annotations in Salesforce?
-
What are the different annotations in Salesforce?
Posted by Ratnesh on April 15, 2020 at 6:37 AMWhat are the different annotations in Salesforce?
Anuj replied 6 years, 1 month ago 3 Members · 2 Replies -
2 Replies
-
Annotations are defined with an initial @ symbol.
Apex supports the following annotations:
1. @AuraEnabled: It enables client- and server-side access to an apex controller method.
2. @deprecated: It is used to identify methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside.
3. @ Future: It is used to identify methods that are executed asynchronously.
4. @ isTest: It is used to define classes and methods that only contain code used for testing.
5. @RemoteAction: This annotation provides support for Apex methods used in Visualforce to be called via JavaScript.
6. @ReadOnly: It allows you to perform unrestricted queries against the Lightning Platform database. - [adinserter block='9']
-
1. An apex annotation modifies the way a method or class is used similar to annotations in Java.
2. Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
3. To add an annotation to a method, specify it immediately before the method or class definition.
EX:-
Public class classname @ future
Public static void methodname (String Name)
Apex supports the following annotations.
@ Deprecated
@ Future
@ Is test
@ Read-only
@ Remote action
Log In to reply.