|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.ParameterType<T>
public abstract class ParameterType<T>
This is the base class for all parameter types. A ParameterType
is used by objects that take some kind of parameter input from an user.
| Field Summary | |
|---|---|
private Class<T> |
clazz
The class of allowed parameter values. |
private T |
defaultValue
Default value of the parameter. |
private Enumeration<T,String> |
enumeration
List of allowed values. |
private int |
height
Height of the input field for the parameter in the GUI. |
private List<T> |
items
List of allowed values. |
private int |
multiplicity
How many values that can be tied to this parameter. 0 is unlimited values and 1 is default. |
private boolean |
notNull
If the parameter can be null or not. |
private Type |
valueType
The matching type of parameter values (can be null) |
private int |
width
Width of the input field for the parameter in the GUI. |
| Constructor Summary | |
|---|---|
ParameterType(Type valueType,
Class<T> clazz)
Creates a parameter type with no default value and allowing null values. |
|
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull)
Creates a new parameter type. |
|
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height)
|
|
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height,
Enumeration<T,String> enumeration)
|
|
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height,
List<T> items)
|
|
| Method Summary | |
|---|---|
T |
getDefaultValue()
Get the default value. |
Enumeration<T,String> |
getEnumeration()
Get the list of values to choose from as an enumeration. |
int |
getHeight()
Get the height of the input field for the parameter in the GUI. |
List<T> |
getItems()
Get the list of values to choose from. |
int |
getMultiplicity()
Get how many values that can be tied to this parameter. 0 is unlimited values and 1 is default. |
boolean |
getNotNull()
Check if the parameter can be null. |
Class<T> |
getParameterClass()
Get the class a value must have to match this parameter type. |
Type |
getValueType()
Get the date type of values that can be stored in this parameter. |
int |
getWidth()
Get the width of the input field in the GUI. |
boolean |
isEnumeration()
Check if the parameter type enumerates the allowed values or not. |
(package private) abstract ParameterValueData<?> |
newParameterValueData()
Create a new ParameterValueData subclass which is used to
store values of this value type in the database. |
void |
validate(String name,
List<?> values)
Check if a list of values contain invalid values. |
void |
validate(String name,
Object value)
Check if a value is valid according to the settings of this parameter type. |
(package private) abstract void |
validateValue(String name,
T value)
Validate a value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private List<T> items
private Enumeration<T,String> enumeration
private final Class<T> clazz
private final Type valueType
private final T defaultValue
private final boolean notNull
private final int height
private final int width
private final int multiplicity
| Constructor Detail |
|---|
ParameterType(Type valueType,
Class<T> clazz)
clazz - The class of the parameters that this type holds
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull)
clazz - The class of the parameters that this type holds.defaultValue - The parameters default value.notNull - If the parameter is allowed to be null.
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height)
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height,
List<T> items)
ParameterType(Type valueType,
Class<T> clazz,
T defaultValue,
boolean notNull,
int multiplicity,
int width,
int height,
Enumeration<T,String> enumeration)
| Method Detail |
|---|
public Type getValueType()
public Class<T> getParameterClass()
public int getHeight()
public int getWidth()
public boolean getNotNull()
public int getMultiplicity()
public T getDefaultValue()
public void validate(String name,
Object value)
throws InvalidDataException
name - The name of the parameter, used for better exception messagesvalue - The value to test
InvalidDataException - If the value is invalid
public void validate(String name,
List<?> values)
throws InvalidDataException
name - The name of the parameter, used for better exception messages.values - A list of objects to check
InvalidDataException - If the list contains too many values as
specified by the getMultiplicity() setting or has invalid values
as checked by validate(String, Object)abstract ParameterValueData<?> newParameterValueData()
ParameterValueData subclass which is used to
store values of this value type in the database.
abstract void validateValue(String name,
T value)
throws InvalidDataException
name - The name of the parameter, use the name if there is need to
throw an exceptionvalue - The value
InvalidDataException - If the value is not validpublic boolean isEnumeration()
getItems() or getEnumeration().
NOTE! If an Enumeration has been supplied the getItems
method will return a list of the keys of the enumeration.
public List<T> getItems()
getEnumeration()public Enumeration<T,String> getEnumeration()
getItems()
in that it has second value attached to each value. The second value
should be used for display purposes only while the first value is
the one that is used.
getItems()
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||