Annotation Description Example
@isTest :
Denotes classes that only
contain code used for
testing your application.
These classes don’t count
against the total amount
of Apex used by your
organization.
@isTest private class MyTest {
// Methods for testing
}
@isTest(
OnInstall=true):
Denotes a test class or
test method that executes
on package installation
@isTest(OnInstall=true)
private class TestClass {
@isTest(
SeeAllData=true):
Denotes a test class or
test method that has access
to all data in the organization
including pre-existing data
that the test didnt create.
The default is false
@isTest(SeeAllData=true)
private class TestClass {
}
@deprecated :
Denotes methods, classes,
exceptions, enums,
interfaces, or variables
that can no longer be
referenced in subsequent
releases of the managed
package in which they
reside
@deprecated
public void limitedShelfLife() {
}
@readOnly :
Denotes methods that
can perform queries
unrestricted by the number
of returned rows limit for a
request
@readOnly:
private void doQuery() {
}
@remoteAction :
Denotes Apex controller
methods that JavaScript
code can call from a
Visualforce page via
JavaScript remoting. The
method must be static and
either public or global.
@remoteAction:
global static String getId(
String s) {
}
@restResource :
Denotes a class that
is available as a REST
resource. The class must
be global. The urlMapping
parameter is your
resource's name and is
relative to https://instance.
salesforce.com/services/
apexrest/.
@restResource(urlMapping=
'/Widget/*')
global with sharing class
MyResource() {
}
No comments:
Post a Comment