org.apache.openjpa.persistence.criteria
Class SelectionImpl<X>

java.lang.Object
  extended by org.apache.openjpa.persistence.criteria.SelectionImpl<X>
Type Parameters:
X - the type this term evaluates to
All Implemented Interfaces:
Selection<X>, TupleElement<X>, CriteriaExpression
Direct Known Subclasses:
CompoundSelections.Array, CompoundSelections.MultiSelection, CompoundSelections.NewInstance, CompoundSelections.Tuple, ExpressionImpl

abstract class SelectionImpl<X>
extends Object
implements Selection<X>, CriteriaExpression

An item selected in the projection clause of Criteria query. Base implementation for all concrete expressions.

Since:
2.0.0
Author:
Pinaki Poddar

Constructor Summary
SelectionImpl(Class<X> cls)
          Construct with the immutable type represented by this selection term.
 
Method Summary
 void acceptVisit(CriteriaExpressionVisitor visitor)
          Accept visit from the given visitor.
 Selection<X> alias(String alias)
          Sets the alias on this selection term.
 StringBuilder asProjection(AliasContext q)
          Get a string representation of this node as a projection term in the context of the given query.
(package private)  void assertValidName(String name)
           
 StringBuilder asValue(AliasContext q)
          Get a string representation of this node as a value in the context of the given query.
 StringBuilder asVariable(AliasContext q)
          Get a string representation of this node as a variable in the context of the given query.
 String getAlias()
          Gets the alias set of this selection term.
 List<Selection<?>> getCompoundSelectionItems()
          Throws IllegalStateException because a selection term, by default, consists of single value.
 Class<X> getJavaType()
          Gets the immutable type represented by this selection term.
(package private)  boolean isAliased()
          Affirms if this expression has been assigned an alias by alias(String) method.
(package private)  boolean isAutoAliased()
          Affirms if the alias of this expression is assigned automatically.
 boolean isCompoundSelection()
          Returns false because a selection term, by default, consists of single value.
(package private)  void setAutoAlias(String alias)
          Sets the alias of this expression internally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionImpl

public SelectionImpl(Class<X> cls)
Construct with the immutable type represented by this selection term.

Method Detail

getJavaType

public Class<X> getJavaType()
Gets the immutable type represented by this selection term.

Specified by:
getJavaType in interface TupleElement<X>

getAlias

public String getAlias()
Gets the alias set of this selection term.

Specified by:
getAlias in interface TupleElement<X>

alias

public Selection<X> alias(String alias)
Sets the alias on this selection term. Alias can only be set once.

Specified by:
alias in interface Selection<X>

setAutoAlias

void setAutoAlias(String alias)
Sets the alias of this expression internally. Only valid if the expression is not aliased explicitly by calling alias(String).


isAutoAliased

boolean isAutoAliased()
Affirms if the alias of this expression is assigned automatically.


isAliased

boolean isAliased()
Affirms if this expression has been assigned an alias by alias(String) method. An alias can be assigned also by internal implementation.

See Also:
isAutoAliased()

getCompoundSelectionItems

public List<Selection<?>> getCompoundSelectionItems()
Throws IllegalStateException because a selection term, by default, consists of single value.

Specified by:
getCompoundSelectionItems in interface Selection<X>

isCompoundSelection

public boolean isCompoundSelection()
Returns false because a selection term, by default, consists of single value.

Specified by:
isCompoundSelection in interface Selection<X>

assertValidName

void assertValidName(String name)

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

asVariable

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

Specified by:
asVariable in interface CriteriaExpression

asProjection

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

Specified by:
asProjection in interface CriteriaExpression

acceptVisit

public void acceptVisit(CriteriaExpressionVisitor visitor)
Description copied from interface: CriteriaExpression
Accept visit from the given visitor. The receiver is responsible to propagate the visitor to the constituent sub-nodes if any.

Specified by:
acceptVisit in interface CriteriaExpression
Parameters:
visitor - a processor to walk the nodes of a tree.


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