planetj.dataengine.parameter
Class AbstractParameter

java.lang.Object
  |
  +--planetj.dataengine.parameter.AbstractParameter
All Implemented Interfaces:
Cloneable, IParameter, Serializable
Direct Known Subclasses:
ContextParameterParameter, DataEngineServletParameter, ExecutingContextParameter, FieldOrUsageIdParameter, ParameterParameter, RequestAttribute, RequestParameter, RuntimeParameter, ShadowParameter

public abstract class AbstractParameter
extends Object
implements IParameter

A general implementation of the IParameter interface

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
AbstractParameter()
           
 
Method Summary
 Object clearValue()
          Clears this parameter's value, returning the current value after it has been cleared.
 Object clone()
          Clones this parameter
 IParameter cloneParameter()
          Clones this parameter
 boolean equals(Object o)
          Tests if the context index, token, and value of the passed IParameter object equal those of this object
 String getCodeReplacementString()
          Gets the String which represents this parameter's value in a String of code.
 IContext getContext()
          Gets the parameter's context
 int getContextIndex()
          Gets the (0-based) index of this parameter within its context
 String getContextSpecificId()
          Gets the context specific ID of this parameter.
 int getDataType()
          Gets the SQL data type of the parameter
 String getDefaultValueAsString()
          Gets this parameter's default value as a String
 IParameterSource getSource()
          Gets the object from which this parameter was generated.
 FieldDescriptorRow getTargetFieldDescriptor()
          Gets a field descriptor describing this parameter's target (i.e.
 String getToken()
          Gets the literal token that was used to denote this parameter in code
 Object getValue()
          Gets the value of the parameter
 int hashCode()
          Gets a hashCode based on the context index, token, and value of this parameter
 boolean isSQLParameter()
          Tests if this parameter should be sent as a parameter to the DB if it is included in a SQL statement.
 void setContext(IContext context)
          Sets the parameter's context
 void setDataType(int newDataType)
          Sets the SQL data type of the parameter
 void setDefaultValueAsString(String value)
          Sets this parameter's default value as a String
 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.
 void setValue(Object value)
          Sets the value of the parameter
 String toString()
          Returns a String representation of this object
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface planetj.dataengine.parameter.IParameter
loadValueFromSource
 

Constructor Detail

AbstractParameter

public AbstractParameter()
Method Detail

clearValue

public Object clearValue()
                  throws CMException
Clears this parameter's value, returning the current value after it has been cleared.

Specified by:
clearValue in interface IParameter
CMException

clone

public final Object clone()
Clones this parameter

Specified by:
clone in interface IParameter
Overrides:
clone in class Object

cloneParameter

public IParameter cloneParameter()
Clones this parameter

Specified by:
cloneParameter in interface IParameter

equals

public boolean equals(Object o)
Tests if the context index, token, and value of the passed IParameter object equal those of this object

Overrides:
equals in class Object

getCodeReplacementString

public String getCodeReplacementString()
Gets the String which represents this parameter's value in a String of code. For SQL parameters, this will be a question mark. For most other parameters, this will be a String representation of the parameter value

Specified by:
getCodeReplacementString in interface IParameter

getContext

public IContext getContext()
Gets the parameter's context

Specified by:
getContext in interface IParameter

getContextIndex

public int getContextIndex()
Gets the (0-based) index of this parameter within its context

Specified by:
getContextIndex in interface IParameter

getContextSpecificId

public String getContextSpecificId()
Gets the context specific ID of this parameter. This is just the context index, with the ID_START char tacked onto the beginning of it and the CONTEXT_SPECIFIC_ID_END char tacked onto the end. Two parameters in different contexts may have the same context specific ID

Specified by:
getContextSpecificId in interface IParameter

getDataType

public int getDataType()
Gets the SQL data type of the parameter

Specified by:
getDataType in interface IParameter

getDefaultValueAsString

public String getDefaultValueAsString()
Gets this parameter's default value as a String


getSource

public IParameterSource getSource()
Gets the object from which this parameter was generated. This value may be null

Specified by:
getSource in interface IParameter

getTargetFieldDescriptor

public FieldDescriptorRow getTargetFieldDescriptor()
                                            throws CMException
Gets a field descriptor describing this parameter's target (i.e. where this parameter's value is being set). Not all parameters will have a target field descriptor.

Specified by:
getTargetFieldDescriptor in interface IParameter
CMException

getToken

public String getToken()
Gets the literal token that was used to denote this parameter in code

Specified by:
getToken in interface IParameter

getValue

public Object getValue()
Gets the value of the parameter

Specified by:
getValue in interface IParameter

hashCode

public int hashCode()
Gets a hashCode based on the context index, token, and value of this parameter

Overrides:
hashCode in class Object

isSQLParameter

public boolean isSQLParameter()
Tests 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.) If this parameter is not part of an SQL statement then it does not matter what this method returns.


setContext

public void setContext(IContext context)
Sets the parameter's context

Specified by:
setContext in interface IParameter

setDataType

public void setDataType(int newDataType)
Sets the SQL data type of the parameter

Specified by:
setDataType in interface IParameter

setDefaultValueAsString

public void setDefaultValueAsString(String value)
Sets this parameter's default value as a String


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

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.)


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
CMException

setValue

public void setValue(Object value)
              throws CMException
Sets the value of the parameter

Specified by:
setValue in interface IParameter
CMException

toString

public String toString()
Returns a String representation of this object

Overrides:
toString in class Object