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

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.exps.Param
All Implemented Interfaces:
Val, org.apache.openjpa.kernel.exps.Constant, org.apache.openjpa.kernel.exps.Parameter, org.apache.openjpa.kernel.exps.Value

public class Param
extends java.lang.Object
implements org.apache.openjpa.kernel.exps.Parameter

A parameter in a filter.

Author:
Abe White

Nested Class Summary
protected static class Const.ConstExpState
          Constant expression state.
 
Field Summary
protected static java.lang.String FALSE
           
protected static java.lang.String TRUE
           
 
Fields inherited from interface org.apache.openjpa.jdbc.kernel.exps.Val
FORCE_OUTER, JOIN_REL, NULL_CMP
 
Constructor Summary
Param(java.lang.String name, java.lang.Class type)
          Constructor.
 
Method Summary
 void acceptVisit(org.apache.openjpa.kernel.exps.ExpressionVisitor visitor)
           
 void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql)
          Append the SQL testing whether this value is empty to the given buffer.
 void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql)
          Append the SQL testing whether this value is not empty to the given buffer.
 void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql)
          Append the SQL testing whether this value is not null to the given buffer.
 void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql)
          Append the SQL testing whether this value is null to the given buffer.
 void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql)
          Append the SQL checking the size of this value.
 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.
 int getIndex()
           
 org.apache.openjpa.meta.ClassMetaData getMetaData()
           
 java.lang.String getName()
           
 java.lang.String getParameterName()
           
 java.lang.Object getSQLValue(Select sel, ExpContext ctx, ExpState state)
          Return the SQL value of this constant.
 java.lang.Class getType()
           
 java.lang.Object getValue(ExpContext ctx, ExpState state)
          Return the value of this constant.
 java.lang.Object getValue(java.lang.Object[] params)
           
 void groupBy(Select sel, ExpContext ctx, ExpState state)
          Group by this value.
 ExpState initialize(Select sel, ExpContext ctx, int flags)
          Initialize the value.
 boolean isAggregate()
           
 boolean isSQLValueNull(Select sel, ExpContext ctx, ExpState state)
          Return true if this constant's SQL value is equivalent to NULL.
 boolean isVariable()
           
 boolean isXPath()
           
 int length(Select sel, ExpContext ctx, ExpState state)
          Return the number of SQL elements in this value.
 java.lang.Object load(ExpContext ctx, ExpState state, Result res)
          Load the data for this value.
 void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc)
          Order by this value.
 void select(Select sel, ExpContext ctx, ExpState state, boolean pks)
          Select the data for this value.
 void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks)
          Select just the columns for this value.
 void setImplicitType(java.lang.Class type)
           
 void setIndex(int idx)
           
 void setMetaData(org.apache.openjpa.meta.ClassMetaData meta)
           
 java.lang.Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, java.lang.Object val)
          Return the datastore value of the given object in the context of this value.
 
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.kernel.exps.Value
acceptVisit, getMetaData, isAggregate, isVariable, isXPath, setMetaData
 

Field Detail

TRUE

protected static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

protected static final java.lang.String FALSE
See Also:
Constant Field Values
Constructor Detail

Param

public Param(java.lang.String name,
             java.lang.Class type)
Constructor. Supply parameter name and type.

Method Detail

getName

public java.lang.String getName()

getParameterName

public java.lang.String getParameterName()
Specified by:
getParameterName in interface org.apache.openjpa.kernel.exps.Parameter

getType

public java.lang.Class getType()
Specified by:
getType in interface org.apache.openjpa.kernel.exps.Value

setImplicitType

public void setImplicitType(java.lang.Class type)
Specified by:
setImplicitType in interface org.apache.openjpa.kernel.exps.Value

getIndex

public int getIndex()

setIndex

public void setIndex(int idx)
Specified by:
setIndex in interface org.apache.openjpa.kernel.exps.Parameter

getValue

public java.lang.Object getValue(java.lang.Object[] params)
Specified by:
getValue in interface org.apache.openjpa.kernel.exps.Constant

getSQLValue

public java.lang.Object getSQLValue(Select sel,
                                    ExpContext ctx,
                                    ExpState state)
Return the SQL value of this constant.


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

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

getMetaData

public org.apache.openjpa.meta.ClassMetaData getMetaData()
Specified by:
getMetaData in interface org.apache.openjpa.kernel.exps.Value

setMetaData

public void setMetaData(org.apache.openjpa.meta.ClassMetaData meta)
Specified by:
setMetaData in interface org.apache.openjpa.kernel.exps.Value

isSQLValueNull

public boolean isSQLValueNull(Select sel,
                              ExpContext ctx,
                              ExpState state)
Return true if this constant's SQL value is equivalent to NULL.


getValue

public java.lang.Object getValue(ExpContext ctx,
                                 ExpState state)
Return the value of this constant. May be more robust than the parameters-only form.


select

public void select(Select sel,
                   ExpContext ctx,
                   ExpState state,
                   boolean pks)
Description copied from interface: Val
Select the data for this value.

Specified by:
select in interface Val

selectColumns

public void selectColumns(Select sel,
                          ExpContext ctx,
                          ExpState state,
                          boolean pks)
Description copied from interface: Val
Select just the columns for this value.

Specified by:
selectColumns in interface Val

groupBy

public void groupBy(Select sel,
                    ExpContext ctx,
                    ExpState state)
Description copied from interface: Val
Group by this value.

Specified by:
groupBy in interface Val

orderBy

public void orderBy(Select sel,
                    ExpContext ctx,
                    ExpState state,
                    boolean asc)
Description copied from interface: Val
Order by this value.

Specified by:
orderBy in interface Val

load

public java.lang.Object load(ExpContext ctx,
                             ExpState state,
                             Result res)
                      throws java.sql.SQLException
Description copied from interface: Val
Load the data for this value.

Specified by:
load in interface Val
Throws:
java.sql.SQLException

length

public int length(Select sel,
                  ExpContext ctx,
                  ExpState state)
Description copied from interface: Val
Return the number of SQL elements in this value.

Specified by:
length in interface Val

appendIsEmpty

public void appendIsEmpty(Select sel,
                          ExpContext ctx,
                          ExpState state,
                          SQLBuffer sql)
Description copied from interface: Val
Append the SQL testing whether this value is empty to the given buffer.

Specified by:
appendIsEmpty in interface Val

appendIsNotEmpty

public void appendIsNotEmpty(Select sel,
                             ExpContext ctx,
                             ExpState state,
                             SQLBuffer sql)
Description copied from interface: Val
Append the SQL testing whether this value is not empty to the given buffer.

Specified by:
appendIsNotEmpty in interface Val

appendSize

public void appendSize(Select sel,
                       ExpContext ctx,
                       ExpState state,
                       SQLBuffer sql)
Description copied from interface: Val
Append the SQL checking the size of this value.

Specified by:
appendSize in interface Val

appendIsNull

public void appendIsNull(Select sel,
                         ExpContext ctx,
                         ExpState state,
                         SQLBuffer sql)
Description copied from interface: Val
Append the SQL testing whether this value is null to the given buffer.

Specified by:
appendIsNull in interface Val

appendIsNotNull

public void appendIsNotNull(Select sel,
                            ExpContext ctx,
                            ExpState state,
                            SQLBuffer sql)
Description copied from interface: Val
Append the SQL testing whether this value is not null to the given buffer.

Specified by:
appendIsNotNull in interface Val

isVariable

public boolean isVariable()
Specified by:
isVariable in interface org.apache.openjpa.kernel.exps.Value

isAggregate

public boolean isAggregate()
Specified by:
isAggregate in interface org.apache.openjpa.kernel.exps.Value

isXPath

public boolean isXPath()
Specified by:
isXPath in interface org.apache.openjpa.kernel.exps.Value

toDataStoreValue

public java.lang.Object toDataStoreValue(Select sel,
                                         ExpContext ctx,
                                         ExpState state,
                                         java.lang.Object val)
Description copied from interface: Val
Return the datastore value of the given object in the context of this value.

Specified by:
toDataStoreValue in interface Val

acceptVisit

public void acceptVisit(org.apache.openjpa.kernel.exps.ExpressionVisitor visitor)
Specified by:
acceptVisit in interface org.apache.openjpa.kernel.exps.Value


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