Package net.sf.basedb.core
Class StringParameterType
- Direct Known Subclasses:
PasswordParameterType
This class represent a parameter type that is a string.
This type defines a
max length
for the text.- Version:
- 2.0
- Author:
- Samuel, Nicklas
- Last modified
- $Date: 2015-04-21 09:59:42 +0200 (ti, 21 apr 2015) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new string parameter type, setting the max length to 255 and nulls are allowed.StringParameterType
(Integer maxLength, String defaultValue, boolean notNull) Create a new string parameter type.StringParameterType
(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height) StringParameterType
(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height, List<String> items) StringParameterType
(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height, Enumeration<String, String> items) StringParameterType
(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height, Enumeration<String, String> items, boolean checkValues) -
Method Summary
Modifier and TypeMethodDescriptionGet the max length of the parameter.(package private) ParameterValueData<String>
Create a newTextParameterValueData
object.toString()
private static Type
typeFromLength
(Integer maxLength) (package private) void
validateValue
(String name, String value) Checks if the value is aString
object and shorter than the maximum length.Methods inherited from class net.sf.basedb.core.ParameterType
getDefaultValue, getEnumeration, getHeight, getItems, getMultiplicity, getNotNull, getParameterClass, getValueType, getWidth, isEnumeration, isMasked, validate, validate
-
Field Details
-
maxLength
-
-
Constructor Details
-
StringParameterType
public StringParameterType()Create a new string parameter type, setting the max length to 255 and nulls are allowed. -
StringParameterType
Create a new string parameter type.- Parameters:
maxLength
- The maximum length of the string that is allowed or null to allow as long as possibledefaultValue
- The default value of this parameternotNull
- FALSE if nulls values are allowed, TRUE otherwise
-
StringParameterType
-
StringParameterType
-
StringParameterType
public StringParameterType(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height, Enumeration<String, String> items) -
StringParameterType
public StringParameterType(Integer maxLength, String defaultValue, boolean notNull, int multiplicity, int width, int height, Enumeration<String, String> items, boolean checkValues)
-
-
Method Details
-
toString
-
validateValue
Checks if the value is aString
object and shorter than the maximum length.- Specified by:
validateValue
in classParameterType<String>
- 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 not a string or too long
-
newParameterValueData
ParameterValueData<String> newParameterValueData()Create a newTextParameterValueData
object.- Specified by:
newParameterValueData
in classParameterType<String>
-
getMaxLength
Get the max length of the parameter.- Returns:
- Max length or null if none is set.
-
typeFromLength
-