- Denotes methods that are executed asynchronously.
global class MyFutureClass {
@future
static void myMethod(String a, Integer i) {
System.debug('Method called with: ' + a +' and ' + i);
// do callout, or execute
// other long-running code
}
}
@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 didn't 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() {
}
@httpGet,@httpPost,
@httpPatch,
@httpPut,
@httpDelete
- Denotes a REST method in a class annotated with @restResource that the runtime invokes when a client sends an HTTPGET, POST, PATCH, PUT, orDELETE respectively. The methods defined with any of these annotations must be global and static.
@httpGet
global static MyWidget__c doGet()
{
}
@httpPost
global static void doPost() {
}
@httpDelete
global static void doDelete() {
}
No comments :
Post a Comment