|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.bridge.util.AbstractDescriptor
org.mmbase.util.functions.Parameter<C>
public class Parameter<C>
Each (function) argument is specified by a Parameter object.
A Parameter contains a name and type (it does not contain a value). An array of this is returned by
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| Nested Class Summary | |
|---|---|
static class |
Parameter.Wrapper
A Parameter.Wrapper wraps one Parameter around a Parameter[] (then you can put it in a Parameter[]). |
| Field Summary | |
|---|---|
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<HttpServletRequest> |
REQUEST
|
static Parameter<HttpServletResponse> |
RESPONSE
|
static Parameter<UserContext> |
USER
|
| Fields inherited from class org.mmbase.bridge.util.AbstractDescriptor |
|---|
description, guiName, key |
| Constructor Summary | |
|---|---|
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 |
|
| Method Summary | ||
|---|---|---|
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
|
emptyArray()
|
|
boolean |
equals(Object o)
Whether parameter equals to other parameter. |
|
protected static
|
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
|
readFromXml(Element element)
|
|
void |
setDefaultValue(C defaultValue)
Sets the default value of this parameter. |
|
String |
toString()
|
|
| Methods inherited from class org.mmbase.bridge.util.AbstractDescriptor |
|---|
clone, clone, getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Parameter<String> LANGUAGE
public static final Parameter<Locale> LOCALE
public static final Parameter<UserContext> USER
public static final Parameter<HttpServletResponse> RESPONSE
public static final Parameter<HttpServletRequest> REQUEST
public static final Parameter<Cloud> CLOUD
public static final Parameter<Node> NODE
public static final Parameter CORENODE
public static final Parameter<String> FIELD
public static final Parameter[] EMPTY
protected DataType<C> dataType
| Constructor Detail |
|---|
public Parameter(String name,
DataType<C> dataType)
name - the name of the parameterdataType - the datatype of the parameter to copy
public 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 value
public 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 value
public 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 set
public Parameter(String name,
C defaultValue)
public Parameter(Map.Entry<String,C> entry)
public Parameter(Parameter<C> p,
boolean required)
public Parameter(Parameter<C> p,
C defaultValue)
| Method Detail |
|---|
public static <C> Parameter<C>[] emptyArray()
public static Parameter<?>[] readArrayFromXml(Element element)
public static <C> Parameter<C> readFromXml(Element element)
public static Class<?> getClassForName(String type)
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 check
IllegalArgumentException - if the type is not compatible
protected C autoCast(Object value)
throws CastException
value - The value to be filled in in this Parameter.
CastException - If no reasonable cast is possbible.public boolean matches(String key)
public int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic String toString()
toString in class AbstractDescriptor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||