Table of Contents |
EX:
Public class classname @ future Public static void method name (String Name)
Apex supports the following annotations.
@depreacated
Public void methodname (string a) {}
Note:
Unmanaged packages cannot contain code that uses the deprecated keyword.
We can not remove the deprecated annotation to undeprecated something in apex after we have released a package version where that item in apex is deprecated.
Note:
Unmanaged package editable by developer and installer cannot be upgraded. In a managed package, certain components are locked, and changes are not allowed.
EX:
Public class classname { @future
Static void methodname (String a, integer I) { // Apex code
Note
Inclined to build a profession as SalesForce Developer? Then here is the blog post on, explore SalesForce Training
Use the istest annotation to define classes or individual methods that only contain code used for the testing application. The istest annotation is similar to creating methods declared a test method.
Note:
Classes defined with the istest annotation don't count against organization limit of 2MB for all apex code individual methods defined with the istest annotation do count against organization limits.
Classes and methods defined as istest can be either Private or Public classes defined as istest must be top-level classes.
The following is the example of a public test class that contains two test methods.
@istest
Public class Testclassname {static testmethod void methodname 1( )
{
// Apex code
}
Static testmethod void methodname 2 ( )
{
// Apex code
}
}
For Apex code using the IsTest(see All Date= true) Annotation to grant test classes and individual test methods access to all data in the organization, including pre-existing data that the test did not create.
Test methods don't have access by default to pre-existing data in the Organization If a test class is defined with the IsTest(See All Data= True) Annotation, this annotation applies to all its test methods whether the test methods are defined with the @IsTest annotation or the test Method Keyword.
The following example shows how to define a test class with the IsTest(seeAllDate=true) annotation all the test methods in this class have access to all data in the organization.
@isTest( SeeAllDate = true)
Public class classNameTest {
Static testmethod void method1(){
// Apex code
}
}
The @ReadOnly annotation allows you to perform unrestricted queries against the Force.com database. All other limits still apply. It's important to note that this annotation, while removing the limit of the number of returned rows for a request, blocks you from performing the following operations within the request: DML operations, calls to System.schedule, calls to methods annotated with @future, and sending emails.
The @ReadOnly annotation is available for Web services and the Schedulable interface. To use the @ReadOnly annotation, the top-level request must be in the schedule execution or the Web service invocation. For example, if a Visualforce page calls a Web service that contains the @ReadOnly annotation, the request fails because Visualforce is the top-level request, not the Web service.
The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript. This process is often referred to as JavaScript remoting.
Methods with the RemoteAction annotation must be static and either global or public.
A simple JavaScript remoting invocation takes the following form.
[ namespace. ]controller.method(
[ parameters..., ]
callbackFunction,
[configuratio]
);
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.