public class BigIntegerPropertyType extends PropertyType<BigInteger> implements Range<BigInteger>
java.math.BigInteger
. new BigInteger(value);
.
Constructor Example | Comments | ||
---|---|---|---|
Property<BigInteger> A_PROPERTY = new Property<BigInteger>("name", new BigIntegerPropertyType()); |
No default value, no minimum or maximum constraints. | ||
Property<BigInteger> A_PROPERTY = |
Default value is "-987654321987654321000000000", no minimum or maximum constraints. | ||
Property<BigInteger> A_PROPERTY = |
No default value,minimum is "187654321987654321000000000" and maximum is "99987654321987654321000000000", both inclusive.. | ||
Property<BigInteger> A_PROPERTY = |
Default value is "487654321987654321000000000",minimum is "187654321987654321000000000" and maximum is "99987654321987654321000000000", both inclusive. | ||
Type of value(s) | Examples | Result | Comments |
Valid | -987654321987654321000000000 | new BigInteger(-987654321987654321000000000) | Validate successfully. |
Valid | 187654321987654321000000000 | new BigInteger(187654321987654321000000000) | Validate successfully. |
Invalid | cow | null |
Validate will throw an exception. The resulting value is null . |
Invalid | 3.23 | 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 . |
BigInteger.BigInteger(String)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of BigIntegerPropertyType
|
Constructor and Description |
---|
BigIntegerPropertyType()
Default constructor, no minimum, maximum or default value.
|
BigIntegerPropertyType(BigInteger defaultValue)
Constructor with default value.
|
BigIntegerPropertyType(BigInteger minValue,
BigInteger maxValue)
Constructor with minimum and maximum value.
|
BigIntegerPropertyType(BigInteger defaultValue,
BigInteger minValue,
BigInteger maxValue)
Constructor with minimum, maximum and default value.
|
Modifier and Type | Method and Description |
---|---|
BigInteger |
getMaxValue()
Gets the max value (inclusive) a value may be.
|
BigInteger |
getMinValue()
Gets the min value (inclusive) a value may be.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
boolean |
isUseMaxValue()
Determines if max value restriction is used.
|
boolean |
isUseMinValue()
Determines if min value restriction is used.
|
void |
setMaxValue(BigInteger maxValue)
Sets the max value (inclusive) a value may be.
|
void |
setMinValue(BigInteger minValue)
Sets the min value (inclusive) a value may be.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
void |
validateIsInRange(String propertyName,
BigInteger value)
Validates that a value is inside the valid range of min and max value if defined.
|
void |
validateMinMaxValues(String propertyName)
Validates that minValue is less or equal to maxValue, must be called by validateConstraints, and if there is a default value that is inside the valid range.
|
BigInteger |
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, toString, toType, validate, validateNullType
public static final String TYPE
public BigIntegerPropertyType()
public BigIntegerPropertyType(BigInteger defaultValue)
defaultValue
- default value returned if property value is undefined.public BigIntegerPropertyType(BigInteger defaultValue, BigInteger minValue, BigInteger maxValue)
defaultValue
- default value returned if property value is undefined, if is null
than it means no default value.minValue
- minimum value, inclusive, if is null
than it means no default value.maxValue
- maximum value, inclusive, if is null
than it means no default value.public BigIntegerPropertyType(BigInteger minValue, BigInteger maxValue)
minValue
- minimum value, inclusive.maxValue
- maximum value, inclusive.public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<BigInteger>
public BigInteger validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<BigInteger>
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<BigInteger>
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 void validateIsInRange(String propertyName, BigInteger value) throws PropertyException
Range
validateIsInRange
in interface Range<BigInteger>
propertyName
- the propertyvalue
- the valuePropertyException
- if minValue is not null
and value is less than, or maxValue is not null
and value is greather than.PropertyType.validateValue(String, String)
public void validateMinMaxValues(String propertyName) throws PropertyException
Range
validateMinMaxValues
in interface Range<BigInteger>
propertyName
- the name of the property.PropertyException
- if minValue is greather than maxValue.PropertyType.validateConstraints(String)
public BigInteger getMaxValue()
getMaxValue
in interface Range<BigInteger>
public BigInteger getMinValue()
getMinValue
in interface Range<BigInteger>
public void setMinValue(BigInteger minValue)
setMinValue
in interface Range<BigInteger>
minValue
- the min value.public void setMaxValue(BigInteger maxValue)
setMaxValue
in interface Range<BigInteger>
maxValue
- the max value.public boolean isUseMinValue()
isUseMinValue
in interface Range<BigInteger>
true
if min value is not null
, otherwise false
.public boolean isUseMaxValue()
isUseMaxValue
in interface Range<BigInteger>
true
if max value is not null
, otherwise false
.