planetj.dataengine.parameter
Class ParameterCollection

java.lang.Object
  extended byplanetj.dataengine.parameter.ParameterCollection
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ParameterCollection
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A Collection of IParameter objects. IParameter objects can be retrieved either by their ID, or by their index (which is determined by the order in which they were added to this collection)

See Also:
Serialized Form

Constructor Summary
ParameterCollection(IContext context)
          Creates a new ParameterCollection
 
Method Summary
 void addParameter(IParameter param)
          Adds a parameter to this collection.
 void clear()
          Removes all parameters from this collection
 ParameterCollection cloneParameterCollection()
          Clones this parameter collection
 ParameterCollection cloneParameterCollection(IContext context)
          Clones this parameter collection.
 boolean equals(java.lang.Object o)
          Tests if two ParameterCollections have equal parameters (in the same order)
 IContext getContext()
          Gets the context associated with this parameter collection
 java.util.Iterator getDisplayParameters()
          Iterates over the parameters in this context which should be displayed to the user.
protected  java.util.List getNamedParametersInternal(java.lang.String parameterName)
          Gets a list of parameters which have the specified name.
 IParameter getParameter(int index)
          Gets a parameter by its index.
 IParameter getParameter(int pIndex, boolean pCreate)
          Gets a parameter by its index.
 IParameter getParameter(java.lang.String parameterId)
          Gets a parameter by its its context specific id, or by its name, or by a named index.
 int getParameterCount()
          Gets the number of parameters present in this context (same as the size()) method
 int getParameterCount(java.lang.Class paramClass)
          Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)
protected  IParameter getParameterInternal(java.lang.String parameterId)
          Gets a parameter by its its context specific id, or by its named index.
 Row getParameterRow()
          Gets the Row to which parameters in this ParameterCollection may choose to be a part of.
 java.util.List getParameters()
          Gets an unmodifiable List of this collection's IParameter objects (in order).
 java.util.Iterator getParameters(java.lang.Class paramType)
          Iterates over the parameters in this collection (in order) which are of the specified Java type, or are subclasses of the specified Java type.
 java.util.List getParameters(java.lang.String parameterId)
          Gets parameters by their context specific id, or by their name, or by a named index.
protected  java.util.List getParametersInternal()
          Gets a List of this collection's IParameter objects (in order).
 int hashCode()
          Gets a hashCode based on the hashCodes of the contained parameters
 void setParameterValues(java.lang.String parameterId, java.lang.Object value)
          Sets the value of parameters in this ParameterCollection
 void shadowize()
          Converts all parameters in this collection to shadow parameters.
 int size()
          Gets the number of parameters present in this context (Same as the getParameterCount()) method
 java.lang.String toString()
          Returns a String representation of this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterCollection

public ParameterCollection(IContext context)
Creates a new ParameterCollection

Method Detail

addParameter

public void addParameter(IParameter param)
                  throws CMException
Adds a parameter to this collection. If there is already a ShadowParameter at the position the new parameter belongs, then that ShadowParameter is replaced with the new parameter. If the ShadowParameter had a value and the new parameter does not, the ShadowParameter's value and data type are transferred to the new parameter.

Throws:
CMException

clear

public void clear()
Removes all parameters from this collection


cloneParameterCollection

public ParameterCollection cloneParameterCollection()
Clones this parameter collection


cloneParameterCollection

public ParameterCollection cloneParameterCollection(IContext context)
Clones this parameter collection.

Parameters:
context - An optional parameter; if this is not null, then all of the cloned parameters in this collection will have their contexts set to the specified context.THE SPECIFIED CONTEXT MUST BE A CLONE OF THE PARAMETERS' EXISTING CONTEXT

equals

public boolean equals(java.lang.Object o)
Tests if two ParameterCollections have equal parameters (in the same order)


getContext

public IContext getContext()
Gets the context associated with this parameter collection


getDisplayParameters

public java.util.Iterator getDisplayParameters()
Iterates over the parameters in this context which should be displayed to the user. The Iterator cannot not be altered.


getNamedParametersInternal

protected java.util.List getNamedParametersInternal(java.lang.String parameterName)
Gets a list of parameters which have the specified name. This method cannot accept names beginning with the "_parm" to indicate a parameter at a specified index. The returned list is never null.


getParameter

public IParameter getParameter(int index)
Gets a parameter by its index. (The index is zero based.) If no parameter exists at that index, one will be created and returned


getParameter

public IParameter getParameter(int pIndex,
                               boolean pCreate)
Gets a parameter by its index.

Parameters:
pIndex - The zero based index of the parameter to get
pCreate - If this is true and no parameter with the specified index exists, a ShadowParameter will be created at the specified index and returned.

getParameter

public IParameter getParameter(java.lang.String parameterId)
Gets a parameter by its its context specific id, or by its name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2) If more than one matching parameter exists (which can only happen if a parameter name is passed) then only one matching parameter is returned


getParameterCount

public int getParameterCount()
Gets the number of parameters present in this context (same as the size()) method


getParameterCount

public int getParameterCount(java.lang.Class paramClass)
Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)


getParameterInternal

protected IParameter getParameterInternal(java.lang.String parameterId)
Gets a parameter by its its context specific id, or by its named index. The context specific id looks like ¤3¿ or ¤0¿ The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2)


getParameterRow

public Row getParameterRow()
                    throws CMException
Gets the Row to which parameters in this ParameterCollection may choose to be a part of. This row currently suffers from the following limitations: it has no table or system alias info; not all parameters in this collection are necessarily in the Row (only parameters of certain types will be in the Row, and even then parameter name collisions may prevent certain parameters from joining the row). JE July 21 2004

Throws:
CMException

getParameters

public java.util.List getParameters()
Gets an unmodifiable List of this collection's IParameter objects (in order).


getParameters

public java.util.Iterator getParameters(java.lang.Class paramType)
Iterates over the parameters in this collection (in order) which are of the specified Java type, or are subclasses of the specified Java type.


getParameters

public java.util.List getParameters(java.lang.String parameterId)
Gets parameters by their context specific id, or by their name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2) The returned List is never null


getParametersInternal

protected java.util.List getParametersInternal()
Gets a List of this collection's IParameter objects (in order).


hashCode

public int hashCode()
Gets a hashCode based on the hashCodes of the contained parameters


setParameterValues

public void setParameterValues(java.lang.String parameterId,
                               java.lang.Object value)
                        throws CMException
Sets the value of parameters in this ParameterCollection

Parameters:
parameterId - A String which identifies the parameters whose values will be set. This String can either be a context specific id, a name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) A parameter name may correspond to multiple parameters, in which case all of these parameters will have their values set by this method The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2)
value - The value to set parameters to
Throws:
CMException

shadowize

public void shadowize()
Converts all parameters in this collection to shadow parameters. The context specific id, index, value, and data type of the converted parameters are retained, all other information in the parameters is lost.


size

public int size()
Gets the number of parameters present in this context (Same as the getParameterCount()) method


toString

public java.lang.String toString()
Returns a String representation of this object