org.apache.jdo.impl.jdoql.scope
Class ParameterTable

java.lang.Object
  extended by org.apache.jdo.impl.jdoql.scope.ParameterTable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ValueTable

public class ParameterTable
extends java.lang.Object

The query parameter table.

Author:
Michael Bouschen
See Also:
Serialized Form

Field Summary
protected static org.apache.jdo.util.I18NHelper msg
          I18N support
 
Constructor Summary
ParameterTable()
           
 
Method Summary
protected  void checkDeclaredIdentifier(java.lang.String name, Declaration decl)
          Internal method to check whether the specified identifier is declared.
 void checkUnboundParams()
          Checks whether all query parameters are bound.
 void declare(Declaration decl)
          Adds a new declaration.
 ParameterTable getCopy()
          Returns a copy of this ParameterTable.
 java.lang.Object getValue(java.lang.String name)
          Returns the current value for the specified identifier.
 void initValueHandling()
          This method initializes the map of values for this ValueTable.
 boolean isCompatibleValue(java.lang.String name, java.lang.Object value)
          Checks whether the type of the specified value is compatible of the type of the identifier from its declaration.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets the value for the specified identifier.
 void setValues(org.apache.jdo.pm.PersistenceManagerInternal queryPM, java.util.Map paramValues)
          Sets all query parameter values.
 void setValues(org.apache.jdo.pm.PersistenceManagerInternal queryPM, java.lang.Object[] paramValues)
          Sets all query parameter values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

msg

protected static final org.apache.jdo.util.I18NHelper msg
I18N support

Constructor Detail

ParameterTable

public ParameterTable()
Method Detail

declare

public void declare(Declaration decl)
Adds a new declaration. The value is initially set to UNDEFINED.

Specified by:
declare in interface ValueTable
Parameters:
decl - the declaration node

getCopy

public ParameterTable getCopy()
Returns a copy of this ParameterTable.

Returns:
a copy of this ParameterTable.

checkDeclaredIdentifier

protected void checkDeclaredIdentifier(java.lang.String name,
                                       Declaration decl)
Internal method to check whether the specified identifier is declared.


setValues

public void setValues(org.apache.jdo.pm.PersistenceManagerInternal queryPM,
                      java.lang.Object[] paramValues)
Sets all query parameter values. The order of declarations in declareParameters defines the order in the specified array of parameter values. The method checks the type compatibility of the query parameter values.

Parameters:
paramValues - the parameter values

setValues

public void setValues(org.apache.jdo.pm.PersistenceManagerInternal queryPM,
                      java.util.Map paramValues)
Sets all query parameter values. The values are taken from the specified map. The method assumes the key in the map to be the parameter name and the value in the map to be the parameter value.

Parameters:
paramValues - the parameter values

checkUnboundParams

public void checkUnboundParams()
Checks whether all query parameters are bound. If not a JDOQueryException is thrown.


initValueHandling

public void initValueHandling()
This method initializes the map of values for this ValueTable. It needs to be called prior to any use of an AbstractValueTable at query execution time.


setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Sets the value for the specified identifier.

Specified by:
setValue in interface ValueTable
Parameters:
name - the name of the identifier
value - the current value of the identifier

getValue

public java.lang.Object getValue(java.lang.String name)
Returns the current value for the specified identifier.

Specified by:
getValue in interface ValueTable
Parameters:
name - the name of the identifier
Returns:
the current value of the identifier

isCompatibleValue

public boolean isCompatibleValue(java.lang.String name,
                                 java.lang.Object value)
Checks whether the type of the specified value is compatible of the type of the identifier from its declaration.

Specified by:
isCompatibleValue in interface ValueTable
Parameters:
name - the name of the identifier
value - the value to be checked
Returns:
true if the type of the value is compatible with the type of the identifier; false otherwise.


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.