org.apache.openjpa.kernel.exps
Class Val

java.lang.Object
  extended by org.apache.openjpa.kernel.exps.Val
All Implemented Interfaces:
Serializable, Value
Direct Known Subclasses:
Aggregate, AggregateVal, Args, BoundVariable, CandidatePath, Cast, Coalesce, CollectionParam, Concat, CurrentDate, Distinct, Extension, GeneralCase, GetMapValue, GetObjectId, IndexOf, Lit, MathVal, Null, NullIf, Param, SimpleCase, StringLength, SubQ, Substring, This, ToLowerCase, ToUpperCase, Trim, Type, TypeLit, UnaryMathVal, UnboundVariable

public abstract class Val
extends Object
implements Value

An in-memory representation of a Value.

Author:
Abe White
See Also:
Serialized Form

Constructor Summary
Val()
           
 
Method Summary
 void acceptVisit(ExpressionVisitor visitor)
          Accept a visit from a tree visitor.
protected  Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params)
          Return a list of values resulting from evaluating each given candidate.
protected abstract  Object eval(Object candidate, Object orig, StoreContext ctx, Object[] params)
          Return this value for the given candidate.
 Object evaluate(Collection candidates, Object orig, StoreContext ctx, Object[] params)
          Return this value as an aggregate projection on the given group of candidates.
 Object evaluate(Object candidate, Object orig, StoreContext ctx, Object[] params)
          Return this value as a projection on the given candidate.
 String getAlias()
          Return select item alias
 ClassMetaData getMetaData()
          Return any associated persistent type.
 String getName()
           
 Path getPath()
           
 Value getSelectAs()
          Return 'this' concrete class if alias is set, otherwise null
 boolean isAggregate()
          Return true if this value is an aggregate.
 boolean isVariable()
          Return true if this value is a variable.
 boolean isXPath()
          Return true if this value is an XML Path.
 void setAlias(String alias)
          Set select item alias
 void setMetaData(ClassMetaData meta)
          Associate a persistent type with 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
getType, setImplicitType
 

Constructor Detail

Val

public Val()
Method Detail

evaluate

public final Object evaluate(Object candidate,
                             Object orig,
                             StoreContext ctx,
                             Object[] params)
Return this value as a projection on the given candidate.


evaluate

public final Object evaluate(Collection candidates,
                             Object orig,
                             StoreContext ctx,
                             Object[] params)
Return this value as an aggregate projection on the given group of candidates.


eval

protected abstract Object eval(Object candidate,
                               Object orig,
                               StoreContext ctx,
                               Object[] params)
Return this value for the given candidate.


eval

protected Collection eval(Collection candidates,
                          Object orig,
                          StoreContext ctx,
                          Object[] params)
Return a list of values resulting from evaluating each given candidate. By default, this implementation invokes #eval(Object,Object,StoreContext,Map) for each instance and packs the return value into a new list. Aggregates should override.


getMetaData

public ClassMetaData getMetaData()
Description copied from interface: Value
Return any associated persistent type.

Specified by:
getMetaData in interface Value

setMetaData

public void setMetaData(ClassMetaData meta)
Description copied from interface: Value
Associate a persistent type with this value.

Specified by:
setMetaData in interface Value

isVariable

public boolean isVariable()
Description copied from interface: Value
Return true if this value is a variable.

Specified by:
isVariable in interface Value

isAggregate

public boolean isAggregate()
Description copied from interface: Value
Return true if this value is an aggregate.

Specified by:
isAggregate in interface Value

isXPath

public boolean isXPath()
Description copied from interface: Value
Return true if this value is an XML Path.

Specified by:
isXPath in interface Value

acceptVisit

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

Specified by:
acceptVisit in interface Value

getAlias

public String getAlias()
Description copied from interface: Value
Return select item alias

Specified by:
getAlias in interface Value

setAlias

public void setAlias(String alias)
Description copied from interface: Value
Set select item alias

Specified by:
setAlias in interface Value

getSelectAs

public Value getSelectAs()
Description copied from interface: Value
Return 'this' concrete class if alias is set, otherwise null

Specified by:
getSelectAs in interface Value

getPath

public Path getPath()
Specified by:
getPath in interface Value

getName

public String getName()
Specified by:
getName in interface Value


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