Package net.sf.basedb.core
Class IntegerParameterType
- java.lang.Object
-
- net.sf.basedb.core.ParameterType<Integer>
-
- net.sf.basedb.core.IntegerParameterType
-
public class IntegerParameterType extends ParameterType<Integer>
This class represent a parameter type that is an integer. This type defines alower limit
and anupper limit
for the range of allowed values.- Version:
- 2.0
- Author:
- Samuel, Nicklas
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
-
Field Summary
Fields Modifier and Type Field Description private Integer
lowerLimit
The lower limit of the parameter.private Integer
upperLimit
The upper limit of the parameter.
-
Constructor Summary
Constructors Constructor Description IntegerParameterType()
Create a new integer parameter type, without any limits and allowing null values.IntegerParameterType(Integer lowerLimit, Integer upperLimit, Integer defaultValue, boolean notNull)
Create a new integer parameter type.IntegerParameterType(Integer lowerLimit, Integer upperLimit, Integer defaultValue, boolean notNull, int multiplicity, int width, int height, List<Integer> items)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getLowerLimit()
Get the lowest valid value of the parameter.Integer
getUpperLimit()
Get the highest valid value of the parameter.(package private) IntegerParameterValueData
newParameterValueData()
Create a newIntegerParameterValueData
object.String
toString()
(package private) void
validateValue(String name, Integer value)
Checks if the value is within the range given by the upper and lower limits if those are given.-
Methods inherited from class net.sf.basedb.core.ParameterType
getDefaultValue, getEnumeration, getHeight, getItems, getMultiplicity, getNotNull, getParameterClass, getValueType, getWidth, isEnumeration, isMasked, validate, validate
-
-
-
-
Constructor Detail
-
IntegerParameterType
public IntegerParameterType()
Create a new integer parameter type, without any limits and allowing null values.
-
IntegerParameterType
public IntegerParameterType(Integer lowerLimit, Integer upperLimit, Integer defaultValue, boolean notNull)
Create a new integer parameter type.- Parameters:
lowerLimit
- The lowest allowed value, or null to have no limitupperLimit
- The highest allowed value, or null to have no limitdefaultValue
- The default value for this parameternotNull
- FALSE if nulls values are allowed, TRUE otherwise
-
-
Method Detail
-
validateValue
void validateValue(String name, Integer value) throws InvalidDataException
Checks if the value is within the range given by the upper and lower limits if those are given.- Specified by:
validateValue
in classParameterType<Integer>
- Parameters:
value
- The value to testname
- The name of the parameter, use the name if there is need to throw an exception- Throws:
InvalidDataException
- If the value is outside the range of allowed values
-
newParameterValueData
IntegerParameterValueData newParameterValueData()
Create a newIntegerParameterValueData
object.- Specified by:
newParameterValueData
in classParameterType<Integer>
-
getLowerLimit
public Integer getLowerLimit()
Get the lowest valid value of the parameter.- Returns:
- Lowest valid value or null if none is set.
-
getUpperLimit
public Integer getUpperLimit()
Get the highest valid value of the parameter.- Returns:
- Highest valid value or null if none is set.
-
-