Languages Features Creators CSV Resources Challenges Add Language
GitHub icon

Apex

Apex - Programming language

< >

Apex is a programming language created in 2007.

#654on PLDB 16Years Old 201Users
19Books 0Papers 23kRepos

Apex is a proprietary programming language provided by the Force.com platform to developers similar to Java and C#. It is a strongly typed, object-oriented, case-insensitive programming language, following a dot-notation and curly-brackets syntax. Apex can be used to execute programmed functions during most processes on the Force.com platform including custom buttons and links, event handlers on record insertion, update, or deletion, via scheduling, or via the custom controllers of Visualforce pages. Due to the multitenant nature of the platform, the language has strictly imposed governor limitations[61] to guard against any code monopolizing shared resources. Salesforce provides a series of asynchronous processing methods for Apex to allow developers to produce longer running and more complex Apex code.


Example from hello-world:
global with sharing class HelloWorld { global static void main() { System.debug('Hello World'); } }
Example from Linguist:
public class GeoUtils { // generate a KML string given a page reference, call getContent() // then cleanup the output. public static string generateFromContent(PageReference pr) { string ret = ''; try { ret = (string) pr.getContent().toString(); ret = ret.replaceAll('"','\'' ); // get content produces quote chars \" ret = ret.replaceAll( '&','&amp;');// we need to escape these in the node value } catch (exception e ) { system.debug( 'ERROR '+e); } ret = ret.replaceAll('\n',' '); // must use ALL since many new line may get ret = ret.replaceAll('\r',' '); // get these also! // system.debug( ret); // dump the KML return ret ; } public static Map<String, String> geo_response = new Map<String, String>{'200'=>'G_GEO_SUCCESS', '400'=>'G_GEO_BAD_REQUEST', '500'=>'G_GEO_SERVER_ERROR', '601'=>'G_GEO_MISSING_ADDRESS', '602'=>'G_GEO_UNKNOWN_ADDRESS', '603'=>'G_GEO_UNAVAILABLE_ADDRESS', '604'=>'G_GEO_UNKNOWN_DIRECTIONS', '610'=>'G_GEO_BAD_KEY', '620'=>'G_GEO_TOO_MANY_QUERIES' }; public static string accountAddressString ( account acct ) { // form an address string given an account object string adr = acct.billingstreet + ',' + acct.billingcity + ',' + acct.billingstate; if ( acct.billingpostalcode != null ) adr += ',' + acct.billingpostalcode; if ( acct.billingcountry != null ) adr += ',' + acct.billingcountry; adr = adr.replaceAll('\"', '' ); adr = adr.replaceAll('\'', '' ); adr = adr.replaceAll( '\n', ' ' ); adr = adr.replaceAll( '\r', ' ' ); system.debug( adr ); return adr; } public static testmethod void t1() { PageReference pageRef = Page.kmlPreviewTemplate; Test.setCurrentPage(pageRef); system.assert ( GeoUtils.generateFromContent( pageRef ) != null ); Account a = new Account( name='foo', billingstreet='main', billingcity='springfield',billingstate='il', billingpostalcode='9',billingcountry='us'); insert a; system.assertEquals( 'main,springfield,il,9,us',accountAddressString( a) ); } }

Keywords in Apex

abstract ABSTRACT Abstract activate ACTIVATE Activate and AND And any ANY Any array ARRAY Array as AS As asc ASC Asc assert ASSERT Assert autonomous AUTONOMOUS Autonomous begin BEGIN Begin bigdecimal BIGDECIMAL Bigdecimal blob BLOB Blob boolean BOOLEAN Boolean break BREAK Break bulk BULK Bulk by BY By case CASE Case cast CAST Cast catch CATCH Catch char CHAR Char class CLASS Class collect COLLECT Collect commit COMMIT Commit const CONST Const continue CONTINUE Continue convertcurrency CONVERTCURRENCY Convertcurrency decimal DECIMAL Decimal default DEFAULT Default delete DELETE Delete desc DESC Desc do DO Do double DOUBLE Double else ELSE Else end END End enum ENUM Enum exception EXCEPTION Exception exit EXIT Exit export EXPORT Export extends EXTENDS Extends false FALSE False final FINAL Final finally FINALLY Finally float FLOAT Float for FOR For from FROM From future FUTURE Future get GET Get global GLOBAL Global goto GOTO Goto group GROUP Group having HAVING Having hint HINT Hint if IF If implements IMPLEMENTS Implements import IMPORT Import in IN In inner INNER Inner insert INSERT Insert instanceof INSTANCEOF Instanceof int INT Int interface INTERFACE Interface into INTO Into join JOIN Join last90days LAST90DAYS Last90days lastmonth LASTMONTH Lastmonth lastndays LASTNDAYS Lastndays lastweek LASTWEEK Lastweek like LIKE Like limit LIMIT Limit list LIST List long LONG Long loop LOOP Loop map MAP Map merge MERGE Merge native NATIVE Native new NEW New next90days NEXT90DAYS Next90days nextmonth NEXTMONTH Nextmonth nextndays NEXTNDAYS Nextndays nextweek NEXTWEEK Nextweek not NOT Not null NULL Null nulls NULLS Nulls number NUMBER Number object OBJECT Object of OF Of on ON On or OR Or outer OUTER Outer override OVERRIDE Override package PACKAGE Package parallel PARALLEL Parallel pragma PRAGMA Pragma private PRIVATE Private protected PROTECTED Protected public PUBLIC Public retrieve RETRIEVE Retrieve return RETURN Return returning RETURNING Returning rollback ROLLBACK Rollback savepoint SAVEPOINT Savepoint search SEARCH Search select SELECT Select set SET Set short SHORT Short sort SORT Sort stat STAT Stat static STATIC Static strictfp STRICTFP Strictfp super SUPER Super switch SWITCH Switch synchronized SYNCHRONIZED Synchronized system SYSTEM System testmethod TESTMETHOD Testmethod then THEN Then this THIS This thismonth THISMONTH Thismonth thisweek THISWEEK Thisweek throw THROW Throw throws THROWS Throws today TODAY Today tolabel TOLABEL Tolabel tomorrow TOMORROW Tomorrow transaction TRANSACTION Transaction transient TRANSIENT Transient trigger TRIGGER Trigger true TRUE True try TRY Try type TYPE Type undelete UNDELETE Undelete update UPDATE Update upsert UPSERT Upsert using USING Using virtual VIRTUAL Virtual void VOID Void volatile VOLATILE Volatile webservice WEBSERVICE Webservice when WHEN When where WHERE Where while WHILE While yesterday YESTERDAY Yesterday

Language features

Feature Supported Token Example
Conditionals
Inheritance
Access Modifiers
Switch Statements
Exceptions
Constants
Classes
While Loops
Booleans true false
MultiLine Comments /* */
/* A comment
*/
Strings '
Line Comments //
// A comment
Comments
Semantic Indentation X

Books about Apex from ISBNdb

title authors year publisher
Advanced Apex Programming for Salesforce.com and Force.com Appleman, Dan 2015 Desaware Publishing
Oracle Apex 4.0 Cookbook M. van Zoest and M. van der Plas 2010 Packt Publishing
Advanced Apex Programming in Salesforce Appleman, Dan 2018 Desaware Publishing
Advanced Apex Programming in Salesforce Appleman, Dan 2021 Desaware Publishing
Advanced Apex Programming in Salesforce Appleman, Dan 2021 Desaware Publishing
Learning Salesforce Development with Apex: Write, Run and Deploy Apex Code with Ease (English Edition) Battisson, Paul 2020 BPB Publications
Mastering Apex Programming: A developer's guide to learning advanced techniques and best practices for building robust Salesforce applications Battisson, Paul 2020-11-20T00:00:01Z Packt Publishing
Apex Design Patterns: Harness the power of Apex design patterns to build robust and scalable code architectures on the Force.com platform Zaa, Jitendra and Verma, Anshul 2016 Packt Publishing
Advanced Apex Programming for Salesforce.com and Force.com Appleman, Dan 2013-10-25T00:00:01Z Desaware Publishing
Learning Apex Programming Kaufman, Matt and Wicherski, Michael 2015 Packt Publishing
Oracle APEX Cookbook, Second Edition der Plas, Marcel van and Zoest, Michel van 2013 Packt Publishing
Oracle Application Express: Build Powerful Data-Centric Web Apps with APEX (Oracle Press) Geller, Arie and Spendolini, Brian 2017 McGraw-Hill Education
Learning Apex Programming Matt Kaufman; Michael Wicherski 20150131 Packt Publishing
Apex Design Patterns Jitendra Zaa 27-04-2016 Packt Publishing
Mastering Apex Programming Paul Battisson; Mike Wheeler 20-11-2020 Packt Publishing
Oracle APEX 4.0 Cookbook Michel van Zoest and Marcel van der Plas 2010-12-14 Packt Publishing
Understanding Oracle APEX 20 Application Development Edward Sciore 20200921 Springer Nature
Advanced Apex Programming For Salesforce.com And Force.com Dan Appleman 2012 Desaware Publishing
Oracle Application Express: Build Powerful Data-Centric Web Apps with APEX Arie Geller; Brian Spendolini 20170505 McGraw-Hill Professional
css-doodle.html · apex.html · openscad.html

View source

- Build the next great programming language · Search · Day 213 · About · Blog · Acknowledgements · Traffic · Traffic Today · GitHub · feedback@pldb.com