T
- the class type which the PropertyType in the list converts to.public class ListPropertyType<T> extends PropertyType<List<T>> implements MarkerListPropertyType, MarkerSubPropertyType
new ArrayList<T>()
, where it is usually null
.null
, a PropertyException is thrown.Constructor Example | Comments | ||
---|---|---|---|
Property<List<URL>> P_LIST_URLS = |
Creates ListPropertyType to hold a list of URLs which uses the protocol "http" no minimum or maximum number of elements restrictions. No default value. | ||
Property<List<Date>> P_LIST_DATES = |
Creates ListPropertyType to hold a list of Dates, with minimum 2 elements and maximum 6 elements (both inclusive). | ||
Type of value(s) | Examples | Result | Comments |
Valid | http://www.jp.dk;http://www.cnn.com | List of : new URL("http://www.jp.dk") ; new URL("http://www.cnn.com") | Validate successfully. |
Valid | «empty string» | Empty list. | Validate successfully. |
Invalid | http://www.jp.dk;NOT_AN_URL;http://www.cnn.com | null |
Validate will throw an exception. The resulting value is null . |
Invalid | null |
null |
Validate will throw an exception. Return default value if set, otherwise null . |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DIVIDER
The default string divider between elements in the list.
|
static String |
TYPE
The type name string constant of ListPropertyType
|
Constructor and Description |
---|
ListPropertyType(PropertyType<T> propertyType)
Returns a ListPropertyType that can hold a list of propertyType using DEFAULT_DIVIDER,
with default value of an empty list and no constraints on minimum or maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
Integer minLength)
Returns a ListPropertyType that can hold a list of propertyType using DEFAULT_DIVIDER,
with default value of an empty list and no constraints on maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
Integer minLength,
Integer maxLength)
Returns a ListPropertyType that can hold a list of propertyType using DEFAULT_DIVIDER,
with default value of an empty list and no constraints on maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
List<T> defaultValue)
Returns a ListPropertyType that can hold a list of propertyType using DEFAULT_DIVIDER,
and no constraints on minimum or maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
List<T> defaultValue,
Integer minLength)
Returns a ListPropertyType that can hold a list of propertyType using DEFAULT_DIVIDER,
no constraints on maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
List<T> defaultValue,
String divider,
Integer minLength,
Integer maxLength)
Returns a ListPropertyType that can hold a list of propertyType using provided divider and an
constraint on the minimum and maximum elements in their must be in the list, and a default value of an empty list.
|
ListPropertyType(PropertyType<T> propertyType,
String divider)
Returns a ListPropertyType that can hold a list of propertyType using provided divider,
with no default value of an empty list and no constraints on minimum or maximum elements in the list.
|
ListPropertyType(PropertyType<T> propertyType,
String divider,
Integer minLength)
Returns a ListPropertyType that can hold a list of propertyType using provided divider and an
constraint on the minimum elements in their must be in the list, and a default value of an empty list.
|
ListPropertyType(PropertyType<T> propertyType,
String divider,
Integer minLength,
Integer maxLength)
Returns a ListPropertyType that can hold a list of propertyType using provided divider and an
constraint on the minimum elements in their must be in the list, and a default value of an empty list.
|
Modifier and Type | Method and Description |
---|---|
String |
getDivider()
Gets the string divider, which splits up the elements in the string.
|
Integer |
getMaxNumberOfElements()
The minimum elements their must be in the list.
|
Integer |
getMinNumberOfElements()
The maximum elements allowed in the list
|
PropertyType<T> |
getPropertyType()
The PropertyType which all the elements must validate to.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
boolean |
isUseMaxNumberOfElements()
Determines if there are maximum element count constraints.
|
boolean |
isUseMinNumberOfElements()
Determine if there are minimum element count constraints.
|
void |
setPropertyType(PropertyType<T> propertyType) |
String |
toString(String propertyName,
List<T> t)
Converts a typed to the string representation.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
List<T> |
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_DIVIDER
public ListPropertyType(PropertyType<T> propertyType)
propertyType
- the type that the list will hold.public ListPropertyType(PropertyType<T> propertyType, List<T> defaultValue)
propertyType
- the type that the list will hold.defaultValue
- default value returned if property value is undefined.public ListPropertyType(PropertyType<T> propertyType, Integer minLength)
propertyType
- the type that the list will hold.minLength
- the minimum elements their must be in the list for it passes validation. (inclusive).public ListPropertyType(PropertyType<T> propertyType, List<T> defaultValue, Integer minLength)
propertyType
- the type that the list will hold.defaultValue
- default value returned if property value is undefined.minLength
- the minimum elements their must be in the list for it passes validation. (inclusive).public ListPropertyType(PropertyType<T> propertyType, Integer minLength, Integer maxLength)
propertyType
- the type that the list will hold.minLength
- the minimum elements their must be in the list for it passes validation. (inclusive).maxLength
- the maximum elements their is allowed to be in the list for it to pass validation. (inclusive).public ListPropertyType(PropertyType<T> propertyType, String divider)
propertyType
- the type that the list will hold.divider
- the string use to divide the elements in the list.public ListPropertyType(PropertyType<T> propertyType, String divider, Integer minLength)
propertyType
- the type that the list will hold.divider
- the string use to divide the elements in the list.minLength
- the minimum elements their must be in the list for it passes validation. (inclusive).public ListPropertyType(PropertyType<T> propertyType, String divider, Integer minLength, Integer maxLength)
propertyType
- the type that the list will hold.divider
- the string use to divide the elements in the list.minLength
- the minimum elements their must be in the list for it passes validation. (inclusive).maxLength
- the maximum elements their is allowed to be in the list for it to pass validation. (inclusive).public ListPropertyType(PropertyType<T> propertyType, List<T> defaultValue, String divider, Integer minLength, Integer maxLength)
propertyType
- the type that the list will hold.defaultValue
- default value returned if property value is undefined.divider
- the string use to divide the elements in the list.minLength
- the minimum elements their must be in the list for it to pass validation. (inclusive).maxLength
- the maximum elements their is allowed to be in the list for it to pass validation. (inclusive).public Integer getMaxNumberOfElements()
null
is returned.public Integer getMinNumberOfElements()
null
is returned.public boolean isUseMinNumberOfElements()
true
if getMinLength() is diffent from null
, otherwise false
.public boolean isUseMaxNumberOfElements()
true
if getMaxLength() is diffent from null
, otherwise false
.public String getDivider()
public PropertyType<T> getPropertyType()
public void setPropertyType(PropertyType<T> propertyType)
public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<List<T>>
public List<T> validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<List<T>>
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<List<T>>
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, List<T> t) throws PropertyException
PropertyType
toString
in class PropertyType<List<T>>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)