public class SequencePropertyType extends PropertyType<SequenceVO>
getNextKey()
, everytime the current value reached the number of Constructor Example | Comments | ||
---|---|---|---|
Property<SequenceVO> A_PROPERTY= new Property<SequenceVO>("name", new SequencePropertyType()); |
Creates SequencePropertyType using DEFAULT_INCREMENTS (50) as key increments. No default value. | ||
Property<SequenceVO> A_PROPERTY= new Property<SequenceVO>("name", new SequencePropertyType(80)); |
Creates SequencePropertyType using 80 as key increments. No default value. | ||
Type of value(s) | Examples | Result | Comments |
Valid | 80 | new Long(45789) | Validate successfully. |
Valid | -125 | new Long(-127) | 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 . |
SequenceVO
,
SequenceVO.getNextKey()
,
Serialized FormModifier and Type | Field and Description |
---|---|
static long |
DEFAULT_INCREMENTS
The default increments of stored keys [50].
|
static String |
TYPE
The type name string constant of SequencePropertyType.
|
Constructor and Description |
---|
SequencePropertyType()
Default constructor, with
null as default value. |
SequencePropertyType(Long increments)
Constructor with increments, and
null as default value. |
Modifier and Type | Method and Description |
---|---|
Long |
getIncrements()
The positive value which the sequence will increment the stored value of the key, before it next will increment it.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
void |
setIncrements(Long increments)
Sets the increments.
|
String |
toString(String propertyName,
SequenceVO t)
Converts a typed to the string representation.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
SequenceVO |
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, validateNullType
public static final String TYPE
public static final long DEFAULT_INCREMENTS
public SequencePropertyType() throws NullPointerException
null
as default value.NullPointerException
- if typeName is null
which it is not.DEFAULT_INCREMENTS
public SequencePropertyType(Long increments)
null
as default value.increments
- the positive value it shall increment the stored key each time it reaches its threshold. Must be equals or greater than one.NullPointerException
- if typeName is null
which it is not.DEFAULT_INCREMENTS
public Long getIncrements()
public void setIncrements(Long increments)
increments
- the positive value it shall increment the stored key each time it reaches its threshold. Must be equals or greater than one.public String toString(String propertyName, SequenceVO t) throws PropertyException
PropertyType
toString
in class PropertyType<SequenceVO>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)
public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<SequenceVO>
public SequenceVO validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<SequenceVO>
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 void validateConstraints(String propertyName) throws PropertyException
PropertyType
validateConstraints
in class PropertyType<SequenceVO>
propertyName
- the name of the property used for logging purposes, to
identify the unique property which PropertyType has constraint
issues.PropertyException
- if the constraints have invalid/conflicting values.Property.validate()