org.apache.avalon.util.criteria
Class Parameter

java.lang.Object
  extended byorg.apache.avalon.util.criteria.Parameter
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PackedParameter

public class Parameter
extends Object
implements Serializable

A parameter is an immutable class that contains a description of an allowable parameter within a crieria instance.

Version:
$Revision: 1.5 $
Author:
Avalon Development Team
See Also:
Serialized Form

Constructor Summary
Parameter(String key, Class type)
          Creation of a new required parameter constraint.
Parameter(String key, Class type, Object value)
          Creation of a new optional parameter constraint.
 
Method Summary
 Object getDefault()
          Return the default value for this parameter.
 String getKey()
          Return the key for the parameter.
static String[] getKeys(Parameter[] params)
          Return the set of keys corresponding to the supplied set of parameters.
 Class getParameterClass()
          Return the classname for the parameter.
 boolean isOptional()
          Return TRUE is the parameter is optional.
 boolean isRequired()
          Return TRUE is the parameter is required.
protected  Object resolve(Class type, Object value)
          Resolve a supplied argument to a value.
 Object resolve(Object value)
          Resolve a supplied argument to a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameter

public Parameter(String key,
                 Class type)
Creation of a new required parameter constraint.

Parameters:
key - the parameter key
type - the name of a class constraining assigned values

Parameter

public Parameter(String key,
                 Class type,
                 Object value)
Creation of a new optional parameter constraint.

Parameters:
key - the parameter key
type - the name of a class constraining assigned values
value - the default value
Method Detail

getKeys

public static String[] getKeys(Parameter[] params)
Return the set of keys corresponding to the supplied set of parameters.

Parameters:
params - the parameter sequence
Returns:
the corresponding keys

getKey

public String getKey()
Return the key for the parameter.

Returns:
the key

getParameterClass

public Class getParameterClass()
Return the classname for the parameter.

Returns:
the classname

isRequired

public boolean isRequired()
Return TRUE is the parameter is required.

Returns:
the required status of the parameter

isOptional

public boolean isOptional()
Return TRUE is the parameter is optional.

Returns:
the optional status of the parameter

getDefault

public Object getDefault()
Return the default value for this parameter.

Returns:
the default value

resolve

public Object resolve(Object value)
               throws CriteriaException
Resolve a supplied argument to a value.

Parameters:
value - the supplied argument
Returns:
the resolved object
Throws:
Exception - if an error occurs
CriteriaException

resolve

protected Object resolve(Class type,
                         Object value)
                  throws CriteriaException
Resolve a supplied argument to a value.

Parameters:
type - the base class
value - the supplied argument
Returns:
the resolved object
Throws:
Exception - if an error occurs
CriteriaException


Copyright © The Apache Software Foundation. All Rights Reserved.