Save This Page
Home » apache-openjpa-1.1.0-source » org.apache.openjpa » kernel » exps » [javadoc | source]
org.apache.openjpa.kernel.exps
abstract public class: AbstractExpressionBuilder [javadoc | source]
java.lang.Object
   org.apache.openjpa.kernel.exps.AbstractExpressionBuilder

Direct Known Subclasses:
    JPQLExpressionBuilder

Abstract base class to help build expressions. Provides generic language-independent support for variable resolution, path traversal, and error messages.
Field Summary
protected static final  int EX_USER     
protected static final  int EX_FATAL     
protected static final  int EX_UNSUPPORTED     
protected static final  Class TYPE_OBJECT     
protected static final  Class TYPE_STRING     
protected static final  Class TYPE_CHAR_OBJ     
protected static final  Class TYPE_NUMBER     
protected static final  Class TYPE_COLLECTION     
protected static final  Class TYPE_MAP     
protected static final  int CONTAINS_TYPE_ELEMENT     
protected static final  int CONTAINS_TYPE_KEY     
protected static final  int CONTAINS_TYPE_VALUE     
protected final  Resolver resolver     
protected  ExpressionFactory factory     
Constructor:
 public AbstractExpressionBuilder(ExpressionFactory factory,
    Resolver resolver) 
    Constructor.
    Parameters:
    factory - the expression factory to use
    resolver - used to resolve variables, parameters, and class names used in the query
Method from org.apache.openjpa.kernel.exps.AbstractExpressionBuilder Summary:
addAccessPath,   assertUnboundVariablesValid,   bind,   currentQuery,   getAccessPath,   getClassLoader,   getDeclaredVariableType,   getLocalizer,   getMetaData,   getMetaData,   getVariable,   isBound,   isDeclaredVariable,   isSeenVariable,   parseException,   setImplicitContainsTypes,   setImplicitType,   setImplicitTypes,   traversePath,   traversePath,   traverseStaticField,   traverseXPath
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openjpa.kernel.exps.AbstractExpressionBuilder Detail:
 protected ClassMetaData addAccessPath(ClassMetaData meta) 
    Register the specified metadata as being in the query's access path.
 protected  void assertUnboundVariablesValid() 
    Validate that all unbound variables are of a PC type. If not, assume that the user actually made a typo that we took for an implicit unbound variable.
 protected  void bind(Value var) 
    Record that the given variable is bound.
 abstract protected String currentQuery()
    Returns the current string being parsed; used for error messages.
 protected ClassMetaData[] getAccessPath() 
    Return the recorded query access path.
 abstract protected ClassLoader getClassLoader()
    Returns the class loader that should be used for resolving class names (in addition to the resolver in the query).
 abstract protected Class getDeclaredVariableType(String name)
    Returns the type of the named variabe if it has been declared.
 abstract protected Localizer getLocalizer()
    Used for obtaining the Localizer to use for translating error messages.
 protected ClassMetaData getMetaData(Class c,
    boolean required) 
    Convenience method to get metadata for the given type.
 protected ClassMetaData getMetaData(Class c,
    boolean required,
    ClassLoader loader) 
    Convenience method to get metadata for the given type.
 protected Value getVariable(String id,
    boolean bind) 
    Returns a value for the given id.
 protected boolean isBound(Value var) 
    Return true if the given variable has been bound.
 abstract protected boolean isDeclaredVariable(String id)
    Returns whether the specified variable name has been explicitly declared. Note all query languages necessarily support declaring variables.
 protected boolean isSeenVariable(String id) 
    Return whether the given id has been used as a variable.
 protected OpenJPAException parseException(int e,
    String token,
    Object[] args,
    Exception nest) 
    Create a proper parse exception for the given reason.
 protected  void setImplicitContainsTypes(Value val1,
    Value val2,
    int op) 
    Set the implicit types of the given values based on the fact that the first is supposed to contain the second.
 protected static  void setImplicitType(Value val,
    Class expected) 
    Set the implicit type of the given value to the given class.
 protected  void setImplicitTypes(Value val1,
    Value val2,
    Class expected) 
    Set the implicit types of the given values based on the fact that they're used together, and based on the operator type.
 protected Value traversePath(Path path,
    String field) 
    Traverse the given field in the given path.
 protected Value traversePath(Path path,
    String field,
    boolean pcOnly,
    boolean allowNull) 
    Traverse the given field in the given path.
 protected Object traverseStaticField(Class cls,
    String field) 
    Return a constant containing the value of the given static field.
 protected Value traverseXPath(Path path,
    String field)