javax.media.jai
Class ParameterListImpl

java.lang.Object
  extended byjavax.media.jai.ParameterListImpl
All Implemented Interfaces:
ParameterList, Serializable
Direct Known Subclasses:
NegotiableCapability, TileCodecParameterList

public class ParameterListImpl
extends Object
implements ParameterList, Serializable

A concrete implementation of the ParameterList interface. The number, names, Class types and default values are specified via the associated ParameterListDescriptor which should be supplied at construction time. This default implementation should be sufficient for most ParameterLists and normally need not be sub-classed.

Since:
JAI 1.1
See Also:
ParameterList, ParameterListDescriptor, ParameterListDescriptorImpl, Serialized Form

Constructor Summary
ParameterListImpl(ParameterListDescriptor descriptor)
          Creates a ParameterListImpl using the specified ParameterListDescriptor.
 
Method Summary
 boolean getBooleanParameter(String paramName)
          A convenience method to return a parameter as a boolean.
 byte getByteParameter(String paramName)
          A convenience method to return a parameter as a byte.
 char getCharParameter(String paramName)
          A convenience method to return a parameter as a char.
 double getDoubleParameter(String paramName)
          A convenience method to return a parameter as a double.
 float getFloatParameter(String paramName)
          A convenience method to return a parameter as a float.
 int getIntParameter(String paramName)
          A convenience method to return a parameter as an int.
 long getLongParameter(String paramName)
          A convenience method to return a parameter as a long.
 Object getObjectParameter(String paramName)
          Gets a named parameter as an Object.
 ParameterListDescriptor getParameterListDescriptor()
          Returns the associated ParameterListDescriptor.
 short getShortParameter(String paramName)
          A convenience method to return a parameter as a short.
 ParameterList setParameter(String paramName, boolean b)
          Sets a named parameter to a boolean value.
 ParameterList setParameter(String paramName, byte b)
          Sets a named parameter to a byte value.
 ParameterList setParameter(String paramName, char c)
          Sets a named parameter to a char value.
 ParameterList setParameter(String paramName, double d)
          Sets a named parameter to a double value.
 ParameterList setParameter(String paramName, float f)
          Sets a named parameter to a float value.
 ParameterList setParameter(String paramName, int i)
          Sets a named parameter to an int value.
 ParameterList setParameter(String paramName, long l)
          Sets a named parameter to a long value.
 ParameterList setParameter(String paramName, Object obj)
          Sets a named parameter to an Object value.
 ParameterList setParameter(String paramName, short s)
          Sets a named parameter to a short value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterListImpl

public ParameterListImpl(ParameterListDescriptor descriptor)
Creates a ParameterListImpl using the specified ParameterListDescriptor. Initializes the parameters to the defaults (could be ParameterListDescriptor.NO_PARAMETER_DEFAULT) specified by descriptor

Parameters:
descriptor - a ParameterListDescriptor describing the parameter names, defaults etc.
Throws:
IllegalArgumentException - if descriptor is null
Method Detail

getParameterListDescriptor

public ParameterListDescriptor getParameterListDescriptor()
Returns the associated ParameterListDescriptor.

Specified by:
getParameterListDescriptor in interface ParameterList

setParameter

public ParameterList setParameter(String paramName,
                                  byte b)
Sets a named parameter to a byte value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
b - a byte value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Byte
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  boolean b)
Sets a named parameter to a boolean value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
b - a boolean value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Boolean
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  char c)
Sets a named parameter to a char value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
c - a char value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Character
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  short s)
Sets a named parameter to a short value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
s - a short value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Short
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  int i)
Sets a named parameter to an int value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
i - an int value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Integer
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  long l)
Sets a named parameter to a long value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
l - a long value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Long
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  float f)
Sets a named parameter to a float value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
f - a float value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Float
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  double d)
Sets a named parameter to a double value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
d - a double value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the class type of parameter pointed to by the paramName is not a Double
IllegalArgumentException - if the parameter value is invalid.

setParameter

public ParameterList setParameter(String paramName,
                                  Object obj)
Sets a named parameter to an Object value. Checks are made to verify that the parameter is of the right Class type and that the value is valid.

Specified by:
setParameter in interface ParameterList
Parameters:
paramName - a String naming a parameter.
obj - an Object value for the parameter.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalArgumentException - if the parameter value is invalid.

getObjectParameter

public Object getObjectParameter(String paramName)
Gets a named parameter as an Object. Parameters belonging to a primitive type, such as int, will be returned as a member of the corresponding wrapper class, such as Integer

Specified by:
getObjectParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getByteParameter

public byte getByteParameter(String paramName)
A convenience method to return a parameter as a byte.

Specified by:
getByteParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getBooleanParameter

public boolean getBooleanParameter(String paramName)
A convenience method to return a parameter as a boolean.

Specified by:
getBooleanParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getCharParameter

public char getCharParameter(String paramName)
A convenience method to return a parameter as a char.

Specified by:
getCharParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getShortParameter

public short getShortParameter(String paramName)
A convenience method to return a parameter as a short.

Specified by:
getShortParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getIntParameter

public int getIntParameter(String paramName)
A convenience method to return a parameter as an int.

Specified by:
getIntParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getLongParameter

public long getLongParameter(String paramName)
A convenience method to return a parameter as a long.

Specified by:
getLongParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getFloatParameter

public float getFloatParameter(String paramName)
A convenience method to return a parameter as a float.

Specified by:
getFloatParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT

getDoubleParameter

public double getDoubleParameter(String paramName)
A convenience method to return a parameter as a double.

Specified by:
getDoubleParameter in interface ParameterList
Parameters:
paramName - the name of the parameter to be returned.
Throws:
IllegalArgumentException - if paramName is null.
IllegalArgumentException - if there is no parameter with the specified name.
ClassCastException - if the parameter is of a different type.
IllegalStateException - if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT