public class DateFormatPropertyType extends PropertyType<SimpleDateFormat>
java.text.SimpleDateFormat. | Constructor Example | Comments | ||
|---|---|---|---|
Property<SimpleDateFormat> A_PROPERTY = |
Default value is null. |
||
Property<SimpleDateFormat> A_PROPERTY = |
Default value is new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"). |
||
Property<SimpleDateFormat> A_PROPERTY = |
Default value is new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"). |
||
| Type of value(s) | Examples | Result | Comments |
| Valid | yyMMddHHmmssZ | new SimpleDateFormat("yyMMddHHmmssZ") | Validate successfully. |
| Valid | yyyy-MM-dd'T'HH:mm:ss.SSSXXX | new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX") | |
| Invalid | cow | 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. |
SimpleDateFormat,
DateFormat,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of DateFormatPropertyType.
|
| Constructor and Description |
|---|
DateFormatPropertyType()
Returns DateFormatPropertyType where the default value is
null. |
DateFormatPropertyType(SimpleDateFormat defaultValue)
Returns DateFormatPropertyType with default value.
|
DateFormatPropertyType(String defaultValueDateFormatPattern)
Returns DateFormatPropertyType 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,
SimpleDateFormat t)
Converts a typed to the string representation.
|
SimpleDateFormat |
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, validateNullTypepublic static final String TYPE
public DateFormatPropertyType()
null.public DateFormatPropertyType(String defaultValueDateFormatPattern) throws IllegalArgumentException
defaultValueDateFormatPattern - a new instance of SimpleDateFormat with the dateFormatPattern is constructed as defaultValue.IllegalArgumentException - if defaultValueDateFormatPattern is an invalid format.public DateFormatPropertyType(SimpleDateFormat defaultValue)
defaultValue - default value returned if property value is undefined.public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<SimpleDateFormat>public SimpleDateFormat validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<SimpleDateFormat>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, SimpleDateFormat t) throws PropertyException
PropertyTypetoString in class PropertyType<SimpleDateFormat>propertyName - the name of the property used for logging purposes.t - the type T.PropertyException - if conversion failed in validation.PropertyType.validate(String, String)