org.apache.jdo.jdoql.tree
Interface ValueTable

All Known Implementing Classes:
AbstractValueTable

public interface ValueTable

A ValueTable manages values for declared identifiers (such as variables or parameters) of a query. It provides methods to declare an identifier, to set and get its value and check a value to be compaitible with the identifier's type.

Author:
Michael Bouschen

Method Summary
 void declare(Declaration decl)
          This method declares an identifier.
 java.lang.Object getValue(java.lang.String name)
          Returns the current value of the specified identifier.
 boolean isCompatibleValue(java.lang.String name, java.lang.Object value)
          Checks whether the type of the specified value is compatible with the type of the identifier.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets the value of the specified identifier for later retrieval using method getValue(java.lang.String)).
 

Method Detail

declare

public void declare(Declaration decl)
This method declares an identifier. The methods takes the name of the declared identifier from the specified declaration node.

Parameters:
decl - the declaration node

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Sets the value of the specified identifier for later retrieval using method getValue(java.lang.String)). The identifier must be declared (see method declare(org.apache.jdo.jdoql.tree.Declaration)) prior to a call of this method.

Parameters:
name - the name of the identifier
value - the new value of the identifier

getValue

public java.lang.Object getValue(java.lang.String name)
Returns the current value of the specified identifier. The identifier must be declared using method declare(org.apache.jdo.jdoql.tree.Declaration)) and its value must be set using method getValue(java.lang.String)) prior to a call of this method.

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 with the type of the identifier.

Returns:
true if the type of the value is compatible with the type of the identifier; false otherwise