public class MiscellaneousFunctions extends AbstractFunctionHandler implements NotFixedResults
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HANDLER_ID |
q
Constructor and Description |
---|
MiscellaneousFunctions() |
Modifier and Type | Method and Description |
---|---|
double |
abs(java.lang.Number d) |
java.lang.Object |
accessor(Expression oExp,
Expression accExp)
Call the specified accessor on the object.
|
java.lang.Object |
accessor(java.lang.Object o,
java.lang.String acc)
Call the specified accessor on the object.
|
void |
cache(java.util.List allobjs,
Expression exp) |
void |
cache(java.util.List allobjs,
com.gentlyweb.utils.Getter get) |
java.lang.Object |
eval(Expression exp) |
java.lang.String |
fileExtension(java.lang.Object f) |
java.lang.Object |
get(java.lang.Object o,
java.lang.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.
|
java.lang.Object |
get(java.lang.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.
|
java.lang.Object |
ifThen(Expression ifcond,
Expression thenVal) |
java.lang.Object |
ifThenElse(Expression ifcond,
Expression thenVal,
Expression elseVal) |
java.lang.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.
|
java.util.Date |
now(boolean zeroTime)
Return the current date.
|
int |
random() |
int |
random(java.lang.Number n) |
double |
randomDouble() |
java.lang.Object |
save_value(java.lang.Object saveValueName) |
java.lang.Object |
savevalue(java.lang.Object saveValueName) |
java.lang.Object |
saveValue(java.lang.Object saveValueName) |
setQuery
public static final java.lang.String HANDLER_ID
public java.util.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(java.util.List allobjs, com.gentlyweb.utils.Getter get) throws QueryExecutionException
QueryExecutionException
public void cache(java.util.List allobjs, Expression exp) throws QueryExecutionException
QueryExecutionException
public double abs(java.lang.Number d)
public int random()
public int random(java.lang.Number n)
public double randomDouble()
public java.lang.Object saveValue(java.lang.Object saveValueName)
public java.lang.Object savevalue(java.lang.Object saveValueName)
public java.lang.Object save_value(java.lang.Object saveValueName)
public java.lang.String fileExtension(java.lang.Object f)
public java.lang.Object accessor(Expression oExp, Expression accExp) throws java.lang.Exception
oExp
- The expression to use to evaluate to get the object.accExp
- The expression that is evaluated to get the accessor.java.lang.Exception
- If there is something wrong.public java.lang.Object get(java.lang.String name) throws java.lang.Exception
o
- The object to call the "get(String)" method on.name
- The name of the property to retrieve.java.lang.Exception
- If there is something wrong.public java.lang.Object get(java.lang.Object o, java.lang.String name) throws java.lang.Exception
o
- The object to call the "get(String)" method on.name
- The name of the property to retrieve.java.lang.Exception
- If there is something wrong.public java.lang.Object accessor(java.lang.Object o, java.lang.String acc) throws java.lang.Exception
o
- The object to call the accessor on.acc
- The accessor.java.lang.Exception
- If there is something wrong.public java.lang.Object ifThen(Expression ifcond, Expression thenVal) throws QueryExecutionException
QueryExecutionException
public java.lang.Object ifThenElse(Expression ifcond, Expression thenVal, Expression elseVal) throws QueryExecutionException
QueryExecutionException
public java.lang.Object eval(Expression exp) throws QueryExecutionException
QueryExecutionException
public java.lang.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.