org.apache.openjpa.persistence.criteria
Class ParameterExpressionImpl<T>

java.lang.Object
  extended by org.apache.openjpa.persistence.criteria.SelectionImpl<X>
      extended by org.apache.openjpa.persistence.criteria.ExpressionImpl<T>
          extended by org.apache.openjpa.persistence.criteria.ParameterExpressionImpl<T>
Type Parameters:
T - the type of value held by this parameter.
All Implemented Interfaces:
Expression<T>, ParameterExpression<T>, Selection<T>, Parameter<T>, TupleElement<T>, CriteriaExpression

 class ParameterExpressionImpl<T>
extends ExpressionImpl<T>
implements ParameterExpression<T>

Parameter of a criteria query.
A parameter in CriteriaQuery is always a named parameter but can be constructed with a null name. Positional parameters are not allowed in CriteraQuery.

Author:
Pinaki Poddar, Fay wang

Constructor Summary
ParameterExpressionImpl(Class<T> cls, String name)
          Construct a Parameter of given expected value type and name.
 
Method Summary
 StringBuilder asValue(AliasContext q)
          Get a string representation of this node as a value in the context of the given query.
 String getName()
          Gets the name of this parameter.
 Class<T> getParameterType()
           
 Integer getPosition()
          Raises an internal exception because parameters of CriteriaQuery are not positional.
(package private)  void setIndex(int index)
           
 String toString()
           
 Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> q)
          Bridge contract to convert this facade expression to a kernel value.
 
Methods inherited from class org.apache.openjpa.persistence.criteria.ExpressionImpl
as, in, in, in, in, isNotNull, isNull, toKernelExpression
 
Methods inherited from class org.apache.openjpa.persistence.criteria.SelectionImpl
acceptVisit, alias, asProjection, assertValidName, asVariable, getAlias, getCompoundSelectionItems, getJavaType, isAliased, isAutoAliased, isCompoundSelection, setAutoAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.persistence.criteria.Expression
as, in, in, in, in, isNotNull, isNull
 
Methods inherited from interface javax.persistence.criteria.Selection
alias, getCompoundSelectionItems, isCompoundSelection
 
Methods inherited from interface javax.persistence.TupleElement
getAlias, getJavaType
 

Constructor Detail

ParameterExpressionImpl

public ParameterExpressionImpl(Class<T> cls,
                               String name)
Construct a Parameter of given expected value type and name.

Parameters:
cls - expected value type
name - name of the parameter which can be null.
Method Detail

getName

public final String getName()
Gets the name of this parameter. The name can be null.

Specified by:
getName in interface Parameter<T>

getPosition

public final Integer getPosition()
Raises an internal exception because parameters of CriteriaQuery are not positional.

Specified by:
getPosition in interface Parameter<T>

setIndex

void setIndex(int index)

toString

public String toString()
Overrides:
toString in class Object

toValue

public Value toValue(ExpressionFactory factory,
                     CriteriaQueryImpl<?> q)
Description copied from class: ExpressionImpl
Bridge contract to convert this facade expression to a kernel value.

Specified by:
toValue in class ExpressionImpl<T>
Parameters:
factory - creates the kernel expression
q - the query definition context of this expression
Returns:
an equivalent kernel value

asValue

public StringBuilder asValue(AliasContext q)
Description copied from interface: CriteriaExpression
Get a string representation of this node as a value in the context of the given query.

Specified by:
asValue in interface CriteriaExpression
Overrides:
asValue in class SelectionImpl<T>

getParameterType

public Class<T> getParameterType()
Specified by:
getParameterType in interface Parameter<T>


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