New Batch#100 (10th Nov 2021) - Salesforce Admin + Dev Training (WhatsApp: +91 - 8087988044) :https://t.co/p4F3oeQagK

Wednesday 12 September 2012

Annotations

Annotations:
* An Apex annotation modifies the way 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.
global class MyClass {
     @future
     Public static void myMethod(String a)
     {
          //long-running Apex code    
     }
}
Annotations supported by Apex
Annotation Name
Description
@Deprecated
* Use the deprecated annotation to identify methods, classes, exceptions, enums, interfaces or variables that can no longer be referenced in subsequent release of the managed package in which they reside.
* This is useful when you are refactoring code in managed package as the requirements evolve.
* New subscribers cannot see the deprecated elements, while the elements continue to function for existing subscribers and API integrations.
Syntax:
@deprecated
//This method is deprecated, use myOptimizedMethod(String a, String b) instead
Public void myMethod(String a) {
}

@Future

@IsTest

@ReadOnly

@RemoteAction


1 comment:

  1. Also i request you to please provide the explanations for remaining Annotations...

    ReplyDelete

Labels