public class ConstantExpression extends ValueExpression
Constructor and Description |
---|
ConstantExpression() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(java.lang.Object o,
Query q)
Get the value of this constant.
|
java.lang.Class |
getExpectedReturnType(Query q)
Get the expected return type.
|
java.lang.Object |
getValue(java.lang.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(java.lang.Object o,
Query q)
Returns whether the value of this constant represents a
true
value. |
void |
setValue(java.lang.Object v) |
java.lang.String |
toString()
Returns a string representation of this constant.
|
isBracketed, setBracketed
public java.lang.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(java.lang.Object v)
public boolean isTrue(java.lang.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 java.lang.Object getValue(java.lang.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 java.lang.Object evaluate(java.lang.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 java.lang.String toString()
toString
in class Expression