What is Apex programming language

Apex programming language 

 

   

  • Apex is a programming language that uses Java-like syntax and acts like database stored procedures. Apex enables developers to add business logic to system events, such as button clicks, updates of related records, and Visualforce pages.
  • Apex is strongly typed object-oriented, on-demand programming language. It is compiled, stored, and run entirely on the Force.com platform (multi-tenant environment and is very controlled in its invocations and limits).
  • Apex syntax looks mostly like Java and acts like stored procedures.
  • Apex allows developers to attach business logic to the record save process
  • Apex has built-in support for unit test creation and execution.


Apex provided build in support for:

  • DML calls to insert, update, and delete a record.
  • Inline SOQL or SOSL statements for retrieving records.
  • Looping control structures that help with bulk processing.
  • A record locking syntax that prevents record update conflicts.
  • Custom public API calls.
  • Send and receive emails.
  • Web services or XML request/response integrations.
  • Warnings and errors to prevent objects referenced by Apex from being modified.


What is the apex class and Triggers?

  • Apex Classes:
    It is a collection of variables and a library of methods that can be reused.
  • Apex Trigger:
    It is a script that executes before or after a specific data manipulation language (DML) event on a particular Salesforce object.


Apex Data Types:

  • Primitive data types (Integer, Boolean, String)
  • Enum (an enumerated list)
  • sObjects (sObject, or Account, contact, object__c)
  • Collection (list, set, map)
  • Null (for the null constant. Which can be assigned to any variable.
  • An object created by the user – or system-defined classes.


Apex Primitive Type Keyword:

1. String:
Represents Set of characters surrounded by single quotes.

2. Boolean:
This variable can either be true, false or null. Many times, this type of variable can be used as flag in programming to identify if the particular condition is set or not set.

3. Integer:
A 32-bit number that does not include a decimal point. Integers have a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647.

4. Decimal:
This data type represents Number that includes a decimal point. Decimal is an arbitrary precision number.

5. Datetime:
A value that indicates a particular day and time, such as a timestamp. Always create datetime values with a system static method. You can add or subtract an Integer or Double value from a Datetime value, returning a Date value. Addition and subtraction of Integer and Double values are the only arithmetic functions that work with Datetime values. Use Datetime Method  

6. Double:
A 64-bit number that includes a decimal point. 

7. ID:
Represents 18-character Force.com record identifier.

8. Date:
A value that indicates a particular day. Unlike Datetime values, Date values contain no information about time. Always create date values with a system static method.

9. Long:
Represents 64-bit number that doesn’t include a decimal point. minimum value of -263 maximum value of 263-1.

10. Blob:
A collection of binary data stored as a single object. You can convert this data type to String or from String using the toString and valueOf methods, respectively.

11. Time:
Represents particular time.

12. Object:
Any data type that is supported in Apex. Apex supports primitive data types (such as Integer), user-defined custom classes, the sObject generic type, or an sObject specific type (such as Account). All Apex data types inherit from Object.



Resources:

 Apex Data Types 



Comments

Popular Posts

Asynchronous Apex in Salesforce : Future Methods

Salesforce Admin Interview Questions and Answers

Apex Triggers in Salesforce

DML - Data Manipulation Language in Apex