public class Parameter<C> extends AbstractDescriptor implements Serializable
Function.getParameterDefinition(), and this same array is used to create new empty Parameters
object (by Function.createParameters()), which can contain actual values for each Parameter.Parameters,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
Parameter.Wrapper
A Parameter.Wrapper wraps one Parameter around a Parameter[] (then you can put it in a
Parameter[]).
|
| Modifier and Type | Field and Description |
|---|---|
static Parameter<Cloud> |
CLOUD |
static Parameter |
CORENODE |
protected DataType<C> |
dataType
The parameter's data type
|
static Parameter[] |
EMPTY
An empty Parameter array.
|
static Parameter<String> |
FIELD |
static Parameter<String> |
LANGUAGE
Parameter which might be needed in lots of Parameter definitions.
|
static Parameter<Locale> |
LOCALE |
static Parameter<Node> |
NODE
'system' parameter set for nodefunctions.
|
static Parameter<javax.servlet.http.HttpServletRequest> |
REQUEST |
static Parameter<javax.servlet.http.HttpServletResponse> |
RESPONSE |
static Parameter<UserContext> |
USER |
description, guiName, key| Constructor and Description |
|---|
Parameter(Map.Entry<String,C> entry)
Create Parameter definition by example value
|
Parameter(Parameter<C> p,
boolean required)
Copy-constructor, just to copy it with different requiredness
|
Parameter(Parameter<C> p,
C defaultValue)
Copy-constructor, just to copy it with different defaultValue (which implies that it is not required now)
|
Parameter(String name,
C defaultValue) |
Parameter(String name,
Class<C> type)
Create a Parameter object
|
Parameter(String name,
Class<C> type,
boolean required)
Create a Parameter object
|
Parameter(String name,
Class<C> type,
C defaultValue)
Create a Parameter object
|
Parameter(String name,
DataType<C> dataType)
Create a Parameter object
|
Parameter(String name,
DataType<C> dataType,
boolean copy)
Create a Parameter object
|
| Modifier and Type | Method and Description |
|---|---|
protected C |
autoCast(Object value)
Tries to 'cast' an object for use with this parameter.
|
void |
checkType(Object value)
Checks if the passed object is of the correct class (compatible with the type of this Parameter),
and throws an IllegalArgumentException if it doesn't.
|
static <C> Parameter<C>[] |
emptyArray() |
boolean |
equals(Object o)
Whether parameter equals to other parameter.
|
protected static <C> Class<C> |
getClass(C v) |
static Class<?> |
getClassForName(String type) |
DataType<C> |
getDataType()
Returns the data type of this parameter.
|
C |
getDefaultValue()
Returns the default value of this parameter (derived from the datatype).
|
Class<C> |
getTypeAsClass()
Returns the type of values that this parameter accepts.
|
int |
hashCode() |
boolean |
isRequired()
Returns whether the parameter requires a value.
|
boolean |
matches(String key) |
static Parameter<?>[] |
readArrayFromXml(Element element) |
static <C> Parameter<C> |
readFromXml(Element element) |
void |
setDefaultValue(C defaultValue)
Sets the default value of this parameter.
|
String |
toString() |
clone, clone, getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUINamepublic static final Parameter<String> LANGUAGE
public static final Parameter<UserContext> USER
public static final Parameter<javax.servlet.http.HttpServletResponse> RESPONSE
public static final Parameter<javax.servlet.http.HttpServletRequest> REQUEST
public static final Parameter<Node> NODE
public static final Parameter CORENODE
public static final Parameter[] EMPTY
public Parameter(String name, DataType<C> dataType)
name - the name of the parameterdataType - the datatype of the parameter to copypublic Parameter(String name, DataType<C> dataType, boolean copy)
name - the name of the parameterdataType - the datatype of the parameter to assign or copycopy - if true, teh datatype is copied. if not, it is assigned directly,
that is, changing condfiitons on the parameter changes the passed datatype instance.public Parameter(String name, Class<C> type)
name - the name of the parametertype - the class of the parameter's possible valuepublic Parameter(String name, Class<C> type, boolean required)
name - the name of the parametertype - the class of the parameter's possible valuerequired - whether the parameter requires a valuepublic Parameter(String name, Class<C> type, C defaultValue)
name - the name of the parametertype - the class of the parameter's possible valuedefaultValue - the value to use if the parameter has no value setpublic Parameter(Map.Entry<String,C> entry)
public Parameter(Parameter<C> p, boolean required)
public static <C> Parameter<C>[] emptyArray()
protected static <C> Class<C> getClass(C v)
public C getDefaultValue()
public void setDefaultValue(C defaultValue)
defaultValue - the default valuepublic DataType<C> getDataType()
public Class<C> getTypeAsClass()
public boolean isRequired()
true if a value is requiredpublic void checkType(Object value)
value - the value whose type (class) to checkIllegalArgumentException - if the type is not compatibleprotected C autoCast(Object value) throws CastException
value - The value to be filled in in this Parameter.CastExceptionpublic boolean matches(String key)
public boolean equals(Object o)
public String toString()
toString in class AbstractDescriptorMMBase 1.9-SNAPSHOT - ${javadoctimestamp}