public class DecimalFormatPropertyType extends PropertyType<DecimalFormat>
java.text.DecimalFormat
. Constructor Example | Comments | ||
---|---|---|---|
Property<DecimalFormat> A_PROPERTY = |
Default value is null . |
||
Property<SimpleDateFormat> A_PROPERTY = |
Default value is new DecimalFormat("###,###.###") . |
||
Property<DecimalFormat> A_PROPERTY = |
Default value is new DecimalFormat("###,###.###") . |
||
Type of value(s) | Examples | Result | Comments |
Valid | ###,###.### | new DecimalFormat("###,###.###") | Validate successfully. |
Valid | 000000.000 | new DecimalFormat("000000.000") | |
Invalid | .0,9,9,% | null |
Validate will throw an exception. The resulting value is null . |
Invalid | «empty string» | null |
|
Invalid | «only spaces» | null |
|
Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
{@link http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html}
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of DecimalFormatPropertyType.
|
Constructor and Description |
---|
DecimalFormatPropertyType()
Returns DecimalFormatPropertyType where the default value is
null . |
DecimalFormatPropertyType(DecimalFormat defaultValue)
Returns DecimalFormatPropertyType with default value.
|
DecimalFormatPropertyType(String defaultValue)
Returns DecimalFormatPropertyType with default value.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
String |
toString(String propertyName,
DecimalFormat t)
Converts a typed to the string representation.
|
DecimalFormat |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toType, validate, validateConstraints, validateNullType
public static final String TYPE
public DecimalFormatPropertyType()
null
.public DecimalFormatPropertyType(String defaultValue) throws IllegalArgumentException
defaultValue
- a new instance of DecimalFormat with the decimalFormatPattern is constructed as defaultValue.IllegalArgumentException
- if "decimalFormatPattern" is invalid.public DecimalFormatPropertyType(DecimalFormat defaultValue)
defaultValue
- default value returned if property value is undefined.public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<DecimalFormat>
public DecimalFormat validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<DecimalFormat>
propertyName
- the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value
- the string representation of the propertyPropertyException
- if the conversion failed.public String toString(String propertyName, DecimalFormat t) throws PropertyException
PropertyType
toString
in class PropertyType<DecimalFormat>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)