planetj.dataengine.parameter
Class ShadowParameter

java.lang.Object
  |
  +--planetj.dataengine.parameter.AbstractParameter
        |
        +--planetj.dataengine.parameter.ShadowParameter
All Implemented Interfaces:
Cloneable, IParameter, Serializable

public class ShadowParameter
extends AbstractParameter

Temporarily holds a parameter value when the appropriate parameter doesn't exist. This can happen when a context's parameter values are set before its code is set, or when a context has parameters with values, but then has its code changed, resulting in the creation of new parameters.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface planetj.dataengine.parameter.IParameter
CONTEXT_SPECIFIC_ID_END, CONTEXT_SPECIFIC_ID_START, DEFAULT_DATA_TYPE, ID_START, PARAMETER_INDEX_PREFIX
 
Constructor Summary
ShadowParameter()
           
 
Method Summary
 Object loadValueFromSource(Object source)
          Loads this parameter's value from a source.
 void setSource(IParameterSource newSource)
          Sets the object from which this parameter was generated.
 void setSQLParameter(boolean sqlp)
          Sets if this parameter should be sent as a parameter to the DB if it is included in a SQL statement.
 void setToken(String token)
          Sets the literal token that was used to denote this parameter in code.
static ShadowParameter toShadow(IParameter param)
          Converts a parameter into a ShadowParameter.
 
Methods inherited from class planetj.dataengine.parameter.AbstractParameter
clearValue, clone, cloneParameter, equals, getCodeReplacementString, getContext, getContextIndex, getContextSpecificId, getDataType, getDefaultValueAsString, getSource, getTargetFieldDescriptor, getToken, getValue, hashCode, isSQLParameter, setContext, setDataType, setDefaultValueAsString, setValue, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShadowParameter

public ShadowParameter()
Method Detail

loadValueFromSource

public Object loadValueFromSource(Object source)
                           throws CMException
Loads this parameter's value from a source. The object passed in may be ignored if the parameter already knows the source from which its value should be extracted.

CMException

setSource

public void setSource(IParameterSource newSource)
Sets the object from which this parameter was generated. This value may be null

Specified by:
setSource in interface IParameter
Overrides:
setSource in class AbstractParameter

setSQLParameter

public void setSQLParameter(boolean sqlp)
Sets if this parameter should be sent as a parameter to the DB if it is included in a SQL statement. The DB can handle fewer type of parameters than the DataEngine, so not all DataEngine parameters can be sent as parameters to the DB. (For example, table names cannot be sent as DB parameters.)

Overrides:
setSQLParameter in class AbstractParameter

setToken

public void setToken(String token)
              throws CMException
Sets the literal token that was used to denote this parameter in code. Subclasses may override this method if they need to do additional processing on the token as long as they invoke the setTokenInternal() method to actually set the token

Specified by:
setToken in interface IParameter
Overrides:
setToken in class AbstractParameter
CMException

toShadow

public static ShadowParameter toShadow(IParameter param)
Converts a parameter into a ShadowParameter. The index, context specific id, value, and data type of the converted parameter are retained, all other information is lost.