public interface MField extends MNode
A 'field' describes a field within a message or record that can have a value. A field typically represents some sort of primitive data type.
Modifier and Type | Method and Description |
---|---|
boolean |
allowsEmpty()
Indicates whether the field allows an empty value when parsed from
String input.
|
CustomFieldHandler |
getCustomFieldHandler()
If the data type is
MDataType.CUSTOM_STRING then this will
return the custom string handler. |
String |
getCustomFieldHandlerClassName()
If the data type is
MDataType.CUSTOM_STRING then this will
return the custom string handler class name. |
MDataType |
getDataType()
Returns the data type of the field.
|
Object |
getDefaultValue()
Returns the default value that the field should be initialised to.
|
int |
getScale()
Returns the scale of the field.
|
void |
setAllowsEmpty(boolean allowsEmpty)
Sets the 'allowsEmpty' option for the field.
|
void |
setDefaultValue(Object value)
Sets a default value that required occurrences of the field are to be
initialised to.
|
void |
setScale(int scale)
Sets the scale of the field.
|
getFullName, getMessage, getMultiplicity, getName, getParent, isField, isMessage, isRecord
MDataType getDataType()
void setDefaultValue(Object value) throws APIException
value
- an initial value - the object specified will be parsed
into the internal type representation for the data type.APIException
- if unable to parse the specified object into
an object that matches the data type of the field.Object getDefaultValue()
void setScale(int scale)
The scale is the number of digits to the right of the decimal
point for a field of type MDataType.DECIMAL_STRING
. For non
decimal data types this value is ignored.
When not explicitly set a value of 2 is assumed.
scale
- the scale of the decimal number.int getScale()
The scale is the number of digits to the right of the decimal
point for a field of type MDataType.DECIMAL_STRING
.
boolean allowsEmpty()
By default MDataType.STRING
type fields allow empty input but
other types do not. This may be used to change this default behaviour.
When a field allows empty input and an empty (zero length string) is parsed then it's internal representation will be a zero length string and not an object of the default type for the field.
void setAllowsEmpty(boolean allowsEmpty)
allowsEmpty
- true to allow the field to parse empty input or false
if parsing of the field should fail upon encountering empty input.allowsEmpty()
String getCustomFieldHandlerClassName()
MDataType.CUSTOM_STRING
then this will
return the custom string handler class name.CustomFieldHandler getCustomFieldHandler()
MDataType.CUSTOM_STRING
then this will
return the custom string handler.Copyright © 2016 Push Technology Ltd. All Rights Reserved.