public class MiscellaneousFunctions extends AbstractFunctionHandler implements NotFixedResults
Modifier and Type | Field and Description |
---|---|
static String |
HANDLER_ID |
q
Constructor and Description |
---|
MiscellaneousFunctions() |
Modifier and Type | Method and Description |
---|---|
double |
abs(Number d) |
Object |
accessor(Expression oExp,
Expression accExp)
Call the specified accessor on the object.
|
Object |
accessor(Object o,
String acc)
Call the specified accessor on the object.
|
void |
cache(List allobjs,
Expression exp) |
void |
cache(List allobjs,
com.gentlyweb.utils.Getter get) |
Object |
eval(Expression exp) |
String |
fileExtension(Object f) |
Object |
get(Object o,
String name)
Get a property from the object using the "get" method, if one exists, the name value
will be used as the property name.
|
Object |
get(String name)
Get a property from the current object using the "get" method, if one exists, the name value
will be used as the property name.
|
Object |
ifThen(Expression ifcond,
Expression thenVal) |
Object |
ifThenElse(Expression ifcond,
Expression thenVal,
Expression elseVal) |
Boolean |
instanceOf(Expression obj,
Expression clazz)
Evaluates the type expression to produce a object whose type
should be compared against the class gained from evaluation of the
clazz expression.
|
Date |
now(boolean zeroTime)
Return the current date.
|
int |
random() |
int |
random(Number n) |
double |
randomDouble() |
Object |
save_value(Object saveValueName) |
Object |
savevalue(Object saveValueName) |
Object |
saveValue(Object saveValueName) |
setQuery
public static final String HANDLER_ID
public Date now(boolean zeroTime)
zeroTime
- If set to true
then the date returned will have it's time fields
set to zero.public void cache(List allobjs, com.gentlyweb.utils.Getter get) throws QueryExecutionException
QueryExecutionException
public void cache(List allobjs, Expression exp) throws QueryExecutionException
QueryExecutionException
public double abs(Number d)
public int random()
public int random(Number n)
public double randomDouble()
public Object accessor(Expression oExp, Expression accExp) throws Exception
oExp
- The expression to use to evaluate to get the object.accExp
- The expression that is evaluated to get the accessor.Exception
- If there is something wrong.public Object get(String name) throws Exception
o
- The object to call the "get(String)" method on.name
- The name of the property to retrieve.Exception
- If there is something wrong.public Object get(Object o, String name) throws Exception
o
- The object to call the "get(String)" method on.name
- The name of the property to retrieve.Exception
- If there is something wrong.public Object accessor(Object o, String acc) throws Exception
o
- The object to call the accessor on.acc
- The accessor.Exception
- If there is something wrong.public Object ifThen(Expression ifcond, Expression thenVal) throws QueryExecutionException
QueryExecutionException
public Object ifThenElse(Expression ifcond, Expression thenVal, Expression elseVal) throws QueryExecutionException
QueryExecutionException
public Object eval(Expression exp) throws QueryExecutionException
QueryExecutionException
public Boolean instanceOf(Expression obj, Expression clazz) throws QueryExecutionException
obj.getValue (q.getCurrentObject (), q) instanceof clazz.getValue (q.getCurrentObject (), q).getClass ()
This is really just a thin wrapper around Class.isInstance(Object)
.
obj
- The expression that represents the object to
against.clazz
- The expression that represents the class of the type
to compare against.QueryExecutionException
- If either of the expressions can't
be evaluated.