org.apache.openjpa.jdbc.kernel.exps
Class ConstPath

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.exps.AbstractVal
      extended by org.apache.openjpa.jdbc.kernel.exps.Const
          extended by org.apache.openjpa.jdbc.kernel.exps.ConstPath
All Implemented Interfaces:
Serializable, JDBCPath, Val, Constant, Path, Value

 class ConstPath
extends Const
implements JDBCPath

A field traversal starting with a constant filter parameter.

Author:
Abe White

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.kernel.exps.Const
Const.ConstExpState
 
Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.kernel.exps.AbstractVal
FALSE, TRUE
 
Fields inherited from interface org.apache.openjpa.jdbc.kernel.exps.Val
ABS_VAL, ARGS_VAL, CMP_EQUAL, COALESCE_VAL, CONCAT_VAL, FORCE_OUTER, GENERALCASE_VAL, INDEXOF_VAL, JOIN_REL, LENGTH_VAL, LOCATE_VAL, LOWER_VAL, MATH_VAL, NULL_CMP, NULLIF_VAL, SIMPLECASE_VAL, SQRT_VAL, SUBSTRING_VAL, TRIM_VAL, UPPER_VAL, VAL, WHENCONDITION_VAL, WHENSCALAR_VAL
 
Constructor Summary
ConstPath(Const constant)
          Constructor.
 
Method Summary
 void acceptVisit(ExpressionVisitor visitor)
          Accept a visit from a tree visitor.
 void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index)
          Append the indexth SQL element to the given buffer.
 void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState)
          Calculate and cache the SQL for this value.
 void get(FieldMetaData field, boolean nullTraversal)
          Traverse into the given field of the current object, and update the current object to that field value.
 void get(FieldMetaData fmd, XMLMetaData meta)
          Traverse into the given field that maps to xml column, and update the current object to that field value.
 void get(XMLMetaData meta, String name)
          Traverse into the gevin xpath name of the current object, and update the current object to that xpath field.
 String getCorrelationVar()
           
 void getKey()
           
 String getSchemaAlias()
           
 Object getSQLValue(Select sel, ExpContext ctx, ExpState state)
          Return the SQL value of this constant.
 Class getType()
          Return the expected type for this value, or Object if the type is unknown.
 Object getValue(ExpContext ctx, ExpState state)
          Return the value of this constant.
 Object getValue(Object[] params)
          Return the value for this constant given the specified parameters.
 XMLMetaData getXmlMapping()
          Return the current XPath's xmlmapping metadata.
 ExpState initialize(Select sel, ExpContext ctx, int flags)
          Initialize the value.
 FieldMetaData last()
          Return the last field in the path, or null if the path does not not contain a final field.
 void setImplicitType(Class type)
          Set the implicit type of the value, based on how it is used in the filter.
 void setSchemaAlias(String schemaAlias)
          Set the schema alias (the identification variable) this path is begin with.
 void setSubqueryContext(Context conext, String correlationVar)
           
 
Methods inherited from class org.apache.openjpa.jdbc.kernel.exps.Const
appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendSize, getMetaData, groupBy, isSQLValueNull, length, load, orderBy, select, selectColumns, setMetaData
 
Methods inherited from class org.apache.openjpa.jdbc.kernel.exps.AbstractVal
appendIndex, appendType, getAlias, getId, getName, getPath, getSelectAs, isAggregate, isVariable, isXPath, setAlias, toDataStoreValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.jdbc.kernel.exps.Val
appendIndex, appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendSize, appendType, getId, getSelectAs, groupBy, length, load, orderBy, select, selectColumns, toDataStoreValue
 
Methods inherited from interface org.apache.openjpa.kernel.exps.Value
getAlias, getMetaData, getName, getPath, isAggregate, isVariable, isXPath, setAlias, setMetaData
 

Constructor Detail

ConstPath

public ConstPath(Const constant)
Constructor. Supply constant to traverse.

Method Detail

getType

public Class getType()
Description copied from interface: Value
Return the expected type for this value, or Object if the type is unknown.

Specified by:
getType in interface Value

setImplicitType

public void setImplicitType(Class type)
Description copied from interface: Value
Set the implicit type of the value, based on how it is used in the filter. This method is only called on values who return Object from Value.getType().

Specified by:
setImplicitType in interface Value

get

public void get(FieldMetaData field,
                boolean nullTraversal)
Description copied from interface: Path
Traverse into the given field of the current object, and update the current object to that field value.

Specified by:
get in interface Path
nullTraversal - if true, allow traversal through a null field

getKey

public void getKey()
Specified by:
getKey in interface JDBCPath

last

public FieldMetaData last()
Description copied from interface: Path
Return the last field in the path, or null if the path does not not contain a final field.

Specified by:
last in interface Path

getValue

public Object getValue(Object[] params)
Description copied from interface: Constant
Return the value for this constant given the specified parameters.

Specified by:
getValue in interface Constant

getValue

public Object getValue(ExpContext ctx,
                       ExpState state)
Description copied from class: Const
Return the value of this constant. May be more robust than the parameters-only form.

Overrides:
getValue in class Const

getSQLValue

public Object getSQLValue(Select sel,
                          ExpContext ctx,
                          ExpState state)
Description copied from class: Const
Return the SQL value of this constant.

Overrides:
getSQLValue in class Const

initialize

public ExpState initialize(Select sel,
                           ExpContext ctx,
                           int flags)
Description copied from interface: Val
Initialize the value. This method should recursively initialize any sub-values.

Specified by:
initialize in interface Val
Overrides:
initialize in class Const

calculateValue

public void calculateValue(Select sel,
                           ExpContext ctx,
                           ExpState state,
                           Val other,
                           ExpState otherState)
Description copied from interface: Val
Calculate and cache the SQL for this value. This method is called before length or any append methods.

Specified by:
calculateValue in interface Val
Overrides:
calculateValue in class Const
other - the value being compared to, or null if not a comparison

appendTo

public void appendTo(Select sel,
                     ExpContext ctx,
                     ExpState state,
                     SQLBuffer sql,
                     int index)
Description copied from interface: Val
Append the indexth SQL element to the given buffer.

Specified by:
appendTo in interface Val

acceptVisit

public void acceptVisit(ExpressionVisitor visitor)
Description copied from interface: Value
Accept a visit from a tree visitor.

Specified by:
acceptVisit in interface Value
Overrides:
acceptVisit in class AbstractVal

get

public void get(FieldMetaData fmd,
                XMLMetaData meta)
Description copied from interface: Path
Traverse into the given field that maps to xml column, and update the current object to that field value.

Specified by:
get in interface Path
Parameters:
fmd - field maps to xml column
meta - associated xml mapping

get

public void get(XMLMetaData meta,
                String name)
Description copied from interface: Path
Traverse into the gevin xpath name of the current object, and update the current object to that xpath field.

Specified by:
get in interface Path

getXmlMapping

public XMLMetaData getXmlMapping()
Description copied from interface: Path
Return the current XPath's xmlmapping metadata.

Specified by:
getXmlMapping in interface Path
Returns:
Return xmlmapping

setSchemaAlias

public void setSchemaAlias(String schemaAlias)
Description copied from interface: Path
Set the schema alias (the identification variable) this path is begin with.

Specified by:
setSchemaAlias in interface Path

getSchemaAlias

public String getSchemaAlias()
Specified by:
getSchemaAlias in interface Path

setSubqueryContext

public void setSubqueryContext(Context conext,
                               String correlationVar)
Specified by:
setSubqueryContext in interface Path

getCorrelationVar

public String getCorrelationVar()
Specified by:
getCorrelationVar in interface Path


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.