public class VersionPropertyType extends PropertyType<VersionVO>
major.minor[.revision][_state[version]][-name]
". Constructor Example | Comments | ||
---|---|---|---|
Property<VersionVO> A_PROPERTY = |
Creates VersionPropertyType. No default value. | ||
Property<VersionVO> A_PROPERTY = |
Creates VersionPropertyType with default value "1.2". | ||
Type of value(s) | Examples | Result | Comments |
Valid | 1.1 | new VersionVO(1,1,null,null,null,null) | Validate successfully. |
Valid | 1.2.3 | new VersionVO(1,2,3,null,null,null) | Validate successfully. |
Valid | 1.4_BETA | new VersionVO(1,2,null,VersionState.BETA,null,null) | Validate successfully. |
Valid | 3.1.9_FINAL2-The final version | new VersionVO(3,1,9,,VersionState.FINAL,2,"The final version") | Validate successfully. |
Invalid | cow | null |
Validate will throw an exception. The resulting value is null . |
Invalid | «empty string» | null |
|
Invalid | «empty string after trim» | null |
|
Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
VersionVO
,
VersionVO.parse(String)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of VersionPropertyType.
|
Constructor and Description |
---|
VersionPropertyType()
Default constructor, with
null as default value. |
VersionPropertyType(VersionVO defaultValue)
Constructor.
|
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,
VersionVO t)
Converts a typed to the string representation.
|
VersionVO |
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 VersionPropertyType()
null
as default value.public VersionPropertyType(VersionVO defaultValue)
defaultValue
- default value returned if property value is undefined.public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<VersionVO>
public VersionVO validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<VersionVO>
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, VersionVO t) throws PropertyException
PropertyType
toString
in class PropertyType<VersionVO>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)