public class ConstantExpression extends ValueExpression
Constructor and Description |
---|
ConstantExpression() |
Modifier and Type | Method and Description |
---|---|
Object |
evaluate(Object o,
Query q)
Get the value of this constant.
|
Class |
getExpectedReturnType(Query q)
Get the expected return type.
|
Object |
getValue(Object o,
Query q)
Get the value of this constant.
|
boolean |
hasFixedResult(Query q)
Always returns
true , well duh! |
void |
init(Query q)
Inits the expression, in reality does nothing here, can't init a constant!
|
boolean |
isTrue(Object o,
Query q)
Returns whether the value of this constant represents a
true
value. |
void |
setValue(Object v) |
String |
toString()
Returns a string representation of this constant.
|
isBracketed, setBracketed
public Class getExpectedReturnType(Query q)
java.lang.String.class
or: java.lang.Double.class
.getExpectedReturnType
in class Expression
q
- The Query object.public void init(Query q)
init
in class Expression
q
- The Query object.public void setValue(Object v)
public boolean isTrue(Object o, Query q)
true
value. See: ArithmeticExpression.isTrue(Object,Query)
for details of how
the return value is determined.isTrue
in class Expression
o
- The current object. Not used in this method.q
- The Query object.true
if the constant evaluates to true
.public Object getValue(Object o, Query q)
getValue
in class ValueExpression
o
- The current object, not used in this method.q
- The Query object, not used in this method.public Object evaluate(Object o, Query q)
evaluate
in class ValueExpression
o
- The current object, not used in this method.q
- The Query object, not used in this method.public boolean hasFixedResult(Query q)
true
, well duh!hasFixedResult
in class Expression
q
- The Query object.true
always.public String toString()
toString
in class Expression