fferpcore.DataTypeglobal class DataType implements ObjectIO.SerializableObject Representation of a scalar data type. Methods
forDescribedFieldglobal static fferpcore.DataType forDescribedField(DescribeFieldResult describedField) Input Parameters
Return ValueThe corresponding DataType for the given DescribeFieldResult. forDisplayTypeglobal static fferpcore.DataType forDisplayType(DisplayType displayType, Integer length, Integer scale) Input Parameters
Return ValueThe corresponding DataType for the given DisplayType. DataTypeglobal 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
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()); coerceToTypeglobal Object coerceToType(Object data) Convert the given data to suitable data for the DataType. The input may be an Object, for example from JSON.deserializeUntyped. It may be a String from user configuration. Input Parameters
Return ValueA new value suitable for the DataType. getNameglobal String getName() This method returns the name of the scalar data type this is associated with. See Salesforce's DisplayType Enum. Return ValueThis 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()); getLengthglobal 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 ValueThis 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()); getScaleglobal 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 ValueThis 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()); toStringglobal override String toString() Display representation. Examples Boolean, String(64), Double(18,2) Return ValueThis 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()); equalsglobal Boolean equals(Object other) hashCodeglobal Integer hashCode() |