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

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.exps.SQLEmbed
All Implemented Interfaces:
Serializable, JDBCFilterListener, FilterListener
Direct Known Subclasses:
SQLExpression, SQLValue

public class SQLEmbed
extends Object
implements JDBCFilterListener

Simple listener which embeds its SQL argument into the query. Listens on sql. Example:
"price < sql(\"(SELECT AVG (PRICE) FROM PRODUCT_TABLE)\")"

See Also:
Serialized Form

Field Summary
static String TAG
           
 
Constructor Summary
SQLEmbed()
           
 
Method Summary
 void appendTo(SQLBuffer buf, FilterValue target, FilterValue[] args, ClassMapping type, JDBCStore store)
          Append the SQL for this expression or value.
 Object evaluate(Object target, Class targetClass, Object[] args, Class[] argClasses, Object candidate, StoreContext ctx)
           
 boolean expectsArguments()
           
 boolean expectsTarget()
           
 String getTag()
           
 Class getType(Class targetClass, Class[] argClasses)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

public static String TAG
Constructor Detail

SQLEmbed

public SQLEmbed()
Method Detail

getTag

public String getTag()
Specified by:
getTag in interface FilterListener

expectsArguments

public boolean expectsArguments()
Specified by:
expectsArguments in interface FilterListener

expectsTarget

public boolean expectsTarget()
Specified by:
expectsTarget in interface FilterListener

evaluate

public Object evaluate(Object target,
                       Class targetClass,
                       Object[] args,
                       Class[] argClasses,
                       Object candidate,
                       StoreContext ctx)
Specified by:
evaluate in interface FilterListener

appendTo

public void appendTo(SQLBuffer buf,
                     FilterValue target,
                     FilterValue[] args,
                     ClassMapping type,
                     JDBCStore store)
Description copied from interface: JDBCFilterListener
Append the SQL for this expression or value.

Specified by:
appendTo in interface JDBCFilterListener
Parameters:
buf - the SQL buffer to append to
target - the target to act on, or null if the listener doesn't expect a target
args - the values of the arguments given in the filter, or null if this listener doesn't expect arguments
type - the class mapping for the query's candidate class
store - the store that owns the query

getType

public Class getType(Class targetClass,
                     Class[] argClasses)
Specified by:
getType in interface FilterListener


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