org.apache.openjpa.jdbc.kernel.exps
public class SQLEmbed extends java.lang.Object implements JDBCFilterListener
sql
.
Example:"price < sql(\"(SELECT AVG (PRICE) FROM PRODUCT_TABLE)\")"
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
Constructor and Description |
---|
SQLEmbed() |
Modifier and Type | Method and Description |
---|---|
void |
appendTo(SQLBuffer buf,
FilterValue target,
FilterValue[] args,
ClassMapping type,
JDBCStore store)
Append the SQL for this expression or value.
|
java.lang.Object |
evaluate(java.lang.Object target,
java.lang.Class targetClass,
java.lang.Object[] args,
java.lang.Class[] argClasses,
java.lang.Object candidate,
StoreContext ctx)
Evaluate the given expression.
|
boolean |
expectsArguments()
Return true if this extension expects arguments to act on.
|
boolean |
expectsTarget()
Return true if this extension expects a target to act on.
|
java.lang.String |
getTag()
Return the tag that this extension listens for.
|
java.lang.Class |
getType(java.lang.Class targetClass,
java.lang.Class[] argClasses)
Return the expected type of the result of this listener.
|
public java.lang.String getTag()
FilterListener
getTag
in interface FilterListener
public boolean expectsArguments()
FilterListener
field.ext:toUpperCase ()
.expectsArguments
in interface FilterListener
public boolean expectsTarget()
FilterListener
field.ext:toUpperCase ()
acts on the target
field
but has no arguments, while another possible form,
ext:toUpperCase (field)
has no target but does have an
argument.expectsTarget
in interface FilterListener
public java.lang.Object evaluate(java.lang.Object target, java.lang.Class targetClass, java.lang.Object[] args, java.lang.Class[] argClasses, java.lang.Object candidate, StoreContext ctx)
FilterListener
evaluate
in interface FilterListener
target
- the target object / field value to act on; will be
null if this extension does not expect a targettargetClass
- the expected class of the target; given in case
the target evaluates to null and typing is neededargs
- the values of the arguments given in the filter;
will be null if this extension does not expect an argumentargClasses
- the expected classes of the arguments; given in case
an argument evaluates to null and typing is neededcandidate
- the candidate object being evaluatedctx
- the persistence contextBoolean.TRUE
or Boolean.FALSE
public void appendTo(SQLBuffer buf, FilterValue target, FilterValue[] args, ClassMapping type, JDBCStore store)
JDBCFilterListener
appendTo
in interface JDBCFilterListener
buf
- the SQL buffer to append totarget
- the target to act on, or null if the listener
doesn't expect a targetargs
- the values of the arguments given in the filter, or
null if this listener doesn't expect argumentstype
- the class mapping for the query's candidate classstore
- the store that owns the querypublic java.lang.Class getType(java.lang.Class targetClass, java.lang.Class[] argClasses)
FilterListener
getType
in interface FilterListener
targetClass
- the expected class of the target, or null if no targetargClasses
- the expected classes of the arguments, or null if
no arguments