Skip to content
Groovy 4 – Data Types
Groovy Supports all of the JAVA primitive and other complex data types and actually does some improvement on them.

Primitive = are types of data that cannot be broken down into other data types.

Primitive types supported by Groovy:

1. Numeric Primitives:

  • Integers:

byte - 8 bit (values from -128 to +127)

short - 16 bit (values from -32,768 to 32,767)

int - 32 bit (values from -2,147,483,648 to 2,147,483,647)

long - 64 bit (values from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807)

  • Floating Point:

float - 32 bit (values from 1.4e-045 to 3.4e+038)

double - 64 bit (values from 4.9e-324 to 1.8e+308)

2. Character Primitive:

char - 16 bit (values from 0 to 65535)

3. Boolean:

boolean - Can have 2 values: true or false. Represents one bit of information. Default value is false.

Class types:

java.lang.Byte

java.lang.Short

java.lang.Integer

java.lang.Long

java.lang.Float

java.lang.Double

java.math.BigInteger

java.math.BigDecimal

java.lang.String

Out of all of those class types, the most important in the context of Sales Cloud are java.lang.String and java.math.BigDecimal.

Strings:

java.lang.String deals with texts, so values from text fields belong to this type.

Strings are usually enclosed in double quotation marks " ". However, Groovy also permits using single quotation marks ' '.

Big Decimals:

java.math.BigDecimal is used for numeric fields.

Big Decimals are float numbers with an arbitrary number of decimals. They are useful for cases requiring more precision, such as currency conversion rates.