apex Flashcards
hosted
apex is saved, compiled, and executed on the server - the lightning platform
object oriented
apex supports classes, interfaces, and inheritance
strongly typed
apex validates references to objects at compile time
multitenant aware
because apex runs in a multitenant platform, it guards closely against runaway code by enforcing limits, which prevent code from monopolizing shared resources
integrated with the database
it is straightforward to access and manipulate records. apex provides direct access to records and their fields, and provides statements and query languages to manipulate those records.
data focused
apex provides transactional access to the database, allowing you to rollback operations
easy to use
apex is based on familiar java idioms
easy to test
apex provides built-in support for unit test creation, execution, and code coverage. salesforce ensures that all custom apex code works as expected by executing all unit tests to any platform upgrades
versioned
custom apex code can be saved against different versions of the API
apex supports
- classes, interfaces, properties, and collections (including arrays)
- object and array notation
- expressions, variables, and constants
- conditionals and control flow
UNLIKE other OOP languages, apex supports:
- cloud development as Apex is stored, compiled, and executed in the cloud
- triggers, which are similar to triggers in DB systems
- transactions and rollbacks
- the global access modifier, which is more permissive than the public modifier and allows access across namespaces and applications
- versioning of custom code
case
apex is a case-insensitive language
Apex data types
primitives: Integer, Double, Long, Date, Datetime, String, ID, Boolean, etc.
sObject: either as a generic sObject or as a specific sObject, such as an Account, Contact, or MyCustomObject__c
collection: list/array of primitives, sObjects, user defined objects, objects created from Apex classes, or collections; a set of primitives; a map from a primitive to primitive, sObject, or collection
enum: typed list of values
user-defined Apex classes
system-supplied apex classes
the following DML statements are available
insert update upsert delete undelete merge
upsert
creates new records and updates sObject records within a single statement, using a specified field to determine the presence of existing objects, or the ID field if no field is specified