T
- the resulting type.public abstract class DerivedPropertyType<T> extends PropertyType<T>
Constructor and Description |
---|
DerivedPropertyType(String typeName,
Integer minDerivedFrom,
Integer maxDerivedFrom,
Property<?>... derivedFrom)
Constructor.
|
DerivedPropertyType(String typeName,
Integer derivedFromCount,
Property<?>... derivedFrom)
Constructor.
|
DerivedPropertyType(String typeName,
Property<?>... derivedFrom)
Constructor.
|
DerivedPropertyType(String typeName,
Property<?> derivedFromType)
Constructs a DerivedPropertyType where the type only has one Property it derives from and default value is
null . |
DerivedPropertyType(String typeName,
Property<?> derivedFromType,
T defaultValue)
Constructs a DerivedPropertyType where the type only has one Property it derives from.
|
DerivedPropertyType(String typeName,
T defaultValue,
Integer minDerivedFrom,
Integer maxDerivedFrom,
Property<?>... derivedFrom)
Constructor.
|
DerivedPropertyType(String typeName,
T defaultValue,
Integer derivedFromCount,
Property<?>... derivedFrom)
Constructor.
|
DerivedPropertyType(String typeName,
T defaultValue,
Property<?>... derivedFrom)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Property<?>[] |
getDerivedFrom()
Gets the array of Property's which this PropertyType is dependent on.
|
int |
getDerivedFromCount()
Gets the number of dependent Property which is provided.
|
Property<?> |
getDerivedFromProperty(int index)
Gets a specific dependent Property in the array.
|
List<String> |
getDerivedFromRestrictions()
Return a list of all the restrictions the DerivedPropertyType has.
|
abstract List<String> |
getDerivedToRestrictions()
Gets a detailed description of the "Derived->TO->PropertyType" with any constraints that might influence the validation.
Without any futher description of of the properties it is derived from, this is taken care of in the method "getDerivedFromRestrictions". |
Integer |
getMaxDerivedFrom()
Gets the maximum number of dependent Property which is allowed.
|
Integer |
getMinDerivedFrom()
Gets the minimum number of dependent Property which is required.
|
List<String> |
getRestrictions()
A list of first "getDerivedToRestrictions" then "getDerivedFromRestrictions".
|
protected boolean |
isMinAndMaxTheSame() |
boolean |
isUseMaxDerivedFrom()
Is maximum limit used.
|
boolean |
isUseMinDerivedFrom()
Is minimum limit used.
|
void |
validateConstraints(String propertyName)
Validates the DerivedPropertyType.
|
abstract T |
validateDerivedValue(String propertyName)
Should convert the dependent Properties to the type T.
|
T |
validateValue(String propertyName,
String value)
This is the normal PropertyType validation method, which is overridden an calls validateDerivedValue(name), from where the implementation must
take the provided properties and convert them into the appropiate type T.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateNullType
public DerivedPropertyType(String typeName, Property<?>... derivedFrom) throws NullPointerException
null
, and minDerivedFrom is 1, and maxDerivedFrom is null
.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, Integer derivedFromCount, Property<?>... derivedFrom) throws NullPointerException
null
, and minDerivedFrom and maxDerivedFrom is the same.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".derivedFromCount
- the number for both tt>minDerivedFrom and maxDerivedFrom. If null
or -1
this is ignored.derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, T defaultValue, Property<?>... derivedFrom) throws NullPointerException
null
.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".defaultValue
- a default value of type T.derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, T defaultValue, Integer derivedFromCount, Property<?>... derivedFrom) throws NullPointerException
null
, and minDerivedFrom and maxDerivedFrom is the same.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".defaultValue
- a default value of type T.derivedFromCount
- the number for both minDerivedFrom and maxDerivedFrom. If null
or -1
this is ignored.derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, Integer minDerivedFrom, Integer maxDerivedFrom, Property<?>... derivedFrom) throws NullPointerException
null
.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".minDerivedFrom
- the minimum number of dependent Property's which must be provided in the "derivedFrom" array. If null
or -1
this is ignored.maxDerivedFrom
- the maximum number of dependent Property's which must be provided in the "derivedFrom" array. If null
or -1
this is ignored.derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, T defaultValue, Integer minDerivedFrom, Integer maxDerivedFrom, Property<?>... derivedFrom) throws NullPointerException
typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".defaultValue
- a default value of type T.minDerivedFrom
- the minimum number of dependent Property's which must be provided in the "derivedFrom" array. If null
or -1
this is ignored.maxDerivedFrom
- the maximum number of dependent Property's which must be provided in the "derivedFrom" array. If null
or -1
this is ignored.derivedFrom
- an array of other Property's, at least one must be provided.NullPointerException
- if typeName is null
.public DerivedPropertyType(String typeName, Property<?> derivedFromType)
null
.typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".derivedFromType
- the Property which the DerivedPropertyType is derived from.public DerivedPropertyType(String typeName, Property<?> derivedFromType, T defaultValue)
typeName
- a short name of the the resulting type. Example "Text from file", "PublicKey from file", "XML from URL".derivedFromType
- the Property which the DerivedPropertyType is derived from.defaultValue
- the default value of the DerivedPropertyType.public final Property<?>[] getDerivedFrom()
public final Integer getMinDerivedFrom()
null
or -1
this means no limit. Though at least one must be provided.public final Integer getMaxDerivedFrom()
null
or -1
this means no limit.public final int getDerivedFromCount()
public final boolean isUseMinDerivedFrom()
true
if value is not null
and greater than -1, otherwise false
.public final boolean isUseMaxDerivedFrom()
true
if value is not null
and greater than -1, otherwise false
.public final Property<?> getDerivedFromProperty(int index) throws ArrayIndexOutOfBoundsException
index
- the index in the dependent Property array.ArrayIndexOutOfBoundsException
- if the index is outside array bounds.protected final boolean isMinAndMaxTheSame()
public final List<String> getRestrictions()
getRestrictions
in class PropertyType<T>
public abstract List<String> getDerivedToRestrictions()
public final List<String> getDerivedFromRestrictions()
StringList
public final T validateValue(String propertyName, String value) throws PropertyException
validateValue
in class PropertyType<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.validateDerivedValue(String)
public abstract T validateDerivedValue(String propertyName) throws PropertyException
propertyName
- the name of derived PropertyPropertyException
- if it could not be converted into type T.public void validateConstraints(String propertyName) throws PropertyException
validateConstraints
in class PropertyType<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()