ERP Core API Developer's Reference

fferpcore.DataType

global class DataType

Representation of a scalar data type.

Methods

DataType

global DataType(Schema.DisplayType type, Integer length, Integer scale)

This constructor creates a class which is a representation of a scalar data type. This holds information about the type, length and scale of the data type.

Input Parameters

Name Type Description
type Schema.DisplayType The type we to associate the data type to.
length Integer The maximum length of the type e.g. number of characters in a string.
scale Integer The accuracy of the type e.g. number of decimals allowed.

Sample Code

//Note: This sample code is for demonstration purposes only, it is not intended for
//use in a production environment, is not guaranteed against defects or errors and
//is in no way optimized or streamlined.

fferpcore.DataType example = new fferpcore.DataType(Schema.DisplayType.Double, 10, 5);

System.assertEquals('DOUBLE', example.getName());
System.assertEquals(10, example.getLength());
System.assertEquals(5, example.getScale());
System.assertEquals('DOUBLE(10,5)', example.toString());

getName

global String getName()

This method returns the name of the scalar data type this is associated with. See Salesforce's DisplayType Enum.

Return Value

This service returns a string object.

Sample Code

//Note: This sample code is for demonstration purposes only, it is not intended for
//use in a production environment, is not guaranteed against defects or errors and
//is in no way optimized or streamlined.

fferpcore.DataType example = new fferpcore.DataType(Schema.DisplayType.Double, 10, 5);

System.assertEquals('DOUBLE', example.getName());
System.assertEquals(10, example.getLength());
System.assertEquals(5, example.getScale());
System.assertEquals('DOUBLE(10,5)', example.toString());

getLength

global Integer getLength()

This method returns the length of the scalar data type this it is associated with. If the data type has a length, for example String or Double, the length value is returned, otherwise NULL is returned.

Return Value

This service returns an Integer object.

Sample Code

//Note: This sample code is for demonstration purposes only, it is not intended for
//use in a production environment, is not guaranteed against defects or errors and
//is in no way optimized or streamlined.

fferpcore.DataType example = new fferpcore.DataType(Schema.DisplayType.Double, 10, 5);

System.assertEquals('DOUBLE', example.getName());
System.assertEquals(10, example.getLength());
System.assertEquals(5, example.getScale());
System.assertEquals('DOUBLE(10,5)', example.toString());

getScale

global Integer getScale()

This method returns the scale of the scalar data type this it is associated with. If the data type has a scale, for example a Double, the scale value is returned, otherwise NULL is returned.

Return Value

This service returns an Integer object.

Sample Code

//Note: This sample code is for demonstration purposes only, it is not intended for
//use in a production environment, is not guaranteed against defects or errors and
//is in no way optimized or streamlined.

fferpcore.DataType example = new fferpcore.DataType(Schema.DisplayType.Double, 10, 5);

System.assertEquals('DOUBLE', example.getName());
System.assertEquals(10, example.getLength());
System.assertEquals(5, example.getScale());
System.assertEquals('DOUBLE(10,5)', example.toString());

toString

global override String toString()

Display representation. Examples Boolean, String(64), Double(18,2)

Return Value

This service returns a string object.

Sample Code

//Note: This sample code is for demonstration purposes only, it is not intended for
//use in a production environment, is not guaranteed against defects or errors and
//is in no way optimized or streamlined.

fferpcore.DataType example = new fferpcore.DataType(Schema.DisplayType.Double, 10, 5);

System.assertEquals('DOUBLE', example.getName());
System.assertEquals(10, example.getLength());
System.assertEquals(5, example.getScale());
System.assertEquals('DOUBLE(10,5)', example.toString());