public class StringPropertiesPropertyType extends PropertyType<Properties>
java.util.Properties
. Constructor Example | Comments | ||
---|---|---|---|
Property<Properties> A_PROPERTY = |
Default constructor, with default element divider, default name/value divider, null as default value, and no element count restrictions. |
||
Property<Properties> A_PROPERTY = |
Constructor, with element divider "," , name/value divider "#", null as default value, and no element count restrictions. |
||
Property<Properties> A_PROPERTY = |
Constructor, with element divider ";" , name/value divider ",", null as default value, and with minumum 3 and maximum 9 elements. |
||
Property<Properties> A_PROPERTY = |
Default constructor, with default element divider, default name/value divider, null as default value, and with minumum 3 and maximum 9 elements. |
||
Property<Properties> A_PROPERTY = |
Default constructor, with default element divider, default name/value divider, null as default value, and with minumum 3 elements and no maximum restrictions. |
||
Type of value(s) | Examples | Result | Comments |
Valid | A=Horse;B=Cow;C=Donkey | new Properties(); with "A=Horse;B=Cow;C=Donkey" | Validate successfully. |
Valid | «empty string» | new Properties(); | |
Valid | «empty string after trim» | new Properties(); | |
Invalid | cow |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
String
,
Properties
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ELEMENT_DIVIDER
The default string that divides elements [;]
|
static String |
DEFAULT_NAME_VALUE_DIVIDER
The default string that divides name value pairs [=]
|
static String |
TYPE
The type name string constant of StringPropertiesPropertyType.
|
Constructor and Description |
---|
StringPropertiesPropertyType()
Default constructor, with default element divider, default name/value divider,
null as default value, and no element count restrictions. |
StringPropertiesPropertyType(Integer minNumberOfElements)
Default constructor, the default element is a null, with default element divider, default name/value divider,
null as default value, and no maximum element count restrictions. |
StringPropertiesPropertyType(Integer minNumberOfElements,
Integer maxNumberOfElements)
Constructor, with all optional elements, the default element is a null, and dividers uses defaults.
|
StringPropertiesPropertyType(Properties defaultValue)
Default constructor, with default element divider, default name/value divider and no element count restrictions.
|
StringPropertiesPropertyType(Properties defaultValue,
Integer minNumberOfElements)
Default constructor, with default element divider, default name/value divider and no maximum element count restrictions.
|
StringPropertiesPropertyType(Properties defaultValue,
Integer minNumberOfElements,
Integer maxNumberOfElements)
Default constructor, with default element divider, default name/value divider.
|
StringPropertiesPropertyType(Properties defaultValue,
String elementDivider,
String nameValueDivider,
Integer minNumberOfElements,
Integer maxNumberOfElements)
Main constructor, with all optional elements, the default element is a empty
Properties instance. |
StringPropertiesPropertyType(String elementDivider)
Constructor, with default name/value divider,
null as default value, and no element count restrictions. |
StringPropertiesPropertyType(String elementDivider,
String nameValueDivider)
Constructor, with
null as default value, and no element count restrictions. |
StringPropertiesPropertyType(String elementDivider,
String nameValueDivider,
Integer minNumberOfElements)
Constructor, with
null as default value, and no maximum element count restrictions. |
Modifier and Type | Method and Description |
---|---|
String |
getElementDivider()
Element divider
|
Integer |
getMaxNumberOfElements()
Maximum element count
|
Integer |
getMinNumberOfElements()
Minimum element count
|
String |
getNameValueDivider()
NameValue divider.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
boolean |
isUseMaxNumberOfElements()
If there are any maximum element count restrictions.
|
boolean |
isUseMinNumberOfElements()
If there are any minimum element count restrictions.
|
void |
setElementDivider(String elementDivider) |
void |
setMaxNumberOfElements(Integer maxNumberOfElements) |
void |
setMinNumberOfElements(Integer minNumberOfElements) |
void |
setNameValueDivider(String nameValueDivider) |
String |
toString(String propertyName,
Properties t)
Converts a typed to the string representation.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
Properties |
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 String DEFAULT_ELEMENT_DIVIDER
public static final String DEFAULT_NAME_VALUE_DIVIDER
public StringPropertiesPropertyType()
null
as default value, and no element count restrictions.public StringPropertiesPropertyType(Properties defaultValue)
defaultValue
- default value returned if property value is undefined.public StringPropertiesPropertyType(Properties defaultValue, Integer minNumberOfElements)
defaultValue
- default value returned if property value is undefined.minNumberOfElements
- the minimum number of elements allowed (inclusive), if null
no minimum elements count restrictions.public StringPropertiesPropertyType(Properties defaultValue, Integer minNumberOfElements, Integer maxNumberOfElements)
defaultValue
- default value returned if property value is undefined.minNumberOfElements
- the minimum number of elements allowed (inclusive), if null
no minimum elements count restrictions.maxNumberOfElements
- the maximum number of elements allowed (inclusive), if null
no maximum elements count restrictions.public StringPropertiesPropertyType(String elementDivider)
null
as default value, and no element count restrictions.elementDivider
- the string that divides the elements.public StringPropertiesPropertyType(String elementDivider, String nameValueDivider)
null
as default value, and no element count restrictions.elementDivider
- the string that divides the elements.nameValueDivider
- the string that divide the individual name value pairs.public StringPropertiesPropertyType(String elementDivider, String nameValueDivider, Integer minNumberOfElements)
null
as default value, and no maximum element count restrictions.elementDivider
- the string that divides the elements in the name value pair.nameValueDivider
- the string that divides the individual name value pairs.minNumberOfElements
- the minimum number of elements allowed (inclusive), if null
no minimum elements count restrictions.public StringPropertiesPropertyType(Integer minNumberOfElements)
null
as default value, and no maximum element count restrictions.minNumberOfElements
- the minimum number of elements allowed (inclusive), if null
no minimum elements count restrictions.public StringPropertiesPropertyType(Integer minNumberOfElements, Integer maxNumberOfElements)
minNumberOfElements
- the minimum number of elements allowed (inclusive), if null
no minimum elements count restrictions.maxNumberOfElements
- the maximum number of elements allowed (inclusive), if null
no maximum elements count restrictions.public StringPropertiesPropertyType(Properties defaultValue, String elementDivider, String nameValueDivider, Integer minNumberOfElements, Integer maxNumberOfElements)
Properties
instance.defaultValue
- default value returned if property value is undefined.elementDivider
- the string that divides the elements in the name value pair.nameValueDivider
- the string that divides the individual name value pairs.minNumberOfElements
- the minimum number of elements allowed (inclusive).maxNumberOfElements
- the maximum number of elements allowed (inclusive).public String getElementDivider()
public String getNameValueDivider()
public Integer getMinNumberOfElements()
null
no minimum elements count restrictions.public Integer getMaxNumberOfElements()
null
no maximum elements count restrictions.public boolean isUseMinNumberOfElements()
true
if getMinNumberOfElements() differs from null
, otherwise false
.public boolean isUseMaxNumberOfElements()
true
if getMaxNumberOfElements() differs from null
, otherwise false
.public void setElementDivider(String elementDivider)
public void setMaxNumberOfElements(Integer maxNumberOfElements)
public void setMinNumberOfElements(Integer minNumberOfElements)
public void setNameValueDivider(String nameValueDivider)
public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<Properties>
public Properties validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<Properties>
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<Properties>
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()
public String toString(String propertyName, Properties t) throws PropertyException
PropertyType
toString
in class PropertyType<Properties>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)