|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.apelon.modules.dts.editor.tql.TQLFunctionAdapter
public abstract class TQLFunctionAdapter
Basic implementation of a TQLFunction
. User functions can
extend this class to get default behaviors. isAggregator
and forceFullSearch
return false. validateArgument
returns the empty string (all arguments are accepted).
At a minimum, the getName
and extractValues
methods must be overridden. Includes a helper method
for extracting the default string value of an attribute.
Copyright (c) 2013 Apelon, Inc. All rights reserved.
Constructor Summary | |
---|---|
TQLFunctionAdapter()
|
Method Summary | |
---|---|
protected java.lang.String |
extractValue(java.lang.Object obj,
TQLField field)
Return the default string value of a DTS Attribute, e.g. |
java.lang.String[] |
extractValues(java.lang.Object[] objs,
TQLField field)
Return the result(s) of the function as applied to the argument objects. |
boolean |
forceFullSearch(java.lang.String op,
java.lang.String value)
Return whether this function, when used in a selector with the operator op and
argument value , should search all objects in the TQL Context . |
java.lang.String |
getName()
Return the base name of this user function (without the initial "%") |
boolean |
isAggregator()
Return whether this function returns one value for each extractValues argument object or
one value for all the arguments (an aggregator). |
java.lang.String |
validateArgument(TQLField field)
Test if the specified function argument is valid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TQLFunctionAdapter()
Method Detail |
---|
public java.lang.String getName()
TQLFunction
getName
in interface TQLFunction
public boolean isAggregator()
TQLFunction
extractValues
argument object or
one value for all the arguments (an aggregator). The value of this method is typically false.
Some functions, such as COUNT
, are aggregators and
must be handled as 'independent' export attributes. In this case, they
must return true to isAggregator()
and the length of the returned array will be one,
not the size of the argument array.
isAggregator
in interface TQLFunction
extractValues
argumentspublic boolean forceFullSearch(java.lang.String op, java.lang.String value)
TQLFunction
op
and
argument value
, should search all objects in the TQL Context
.
This is typically false and search optimizers/accelerators can be used. The COUNT
function,
on the other hand, must search all concepts when a value of zero is acceptable: COUNT(MyProp) < 2
.
In this case, forceFullSearch
must return true to inhibit optimization.
Returning true generally has negative performance implications.
forceFullSearch
in interface TQLFunction
public java.lang.String validateArgument(TQLField field)
TQLFunction
validateArgument
in interface TQLFunction
field
- the TQLField
that defines the argument
public java.lang.String[] extractValues(java.lang.Object[] objs, TQLField field)
TQLFunction
extractValues
in interface TQLFunction
objs
- the array of objects resulting from evaluating the function argumentfield
- the TQLField
object that defines the object
protected java.lang.String extractValue(java.lang.Object obj, TQLField field)
obj
- object as passed in extractValues
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |