|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.josql.expressions.Expression org.josql.expressions.ValueExpression org.josql.expressions.Accessor
public class Accessor
Represents an "accessor" into an object. An accessor is basically a dot separated list
of method names, such as: myObj.id.name
.
All of the methods referenced must have no arguments and be "public" in the referring class.
You can use either the actual method name or the JavaBean naming convention.
Thus: myObj.id.name
might also be represented as: getMyObj.getId.getName
.
Constructor Summary | |
---|---|
Accessor()
|
Method Summary | |
---|---|
boolean |
equals(Object o)
|
Object |
evaluate(Object o,
Query q)
|
String |
getAccessor()
|
Class |
getExpectedReturnType(Query q)
Return the class of the object that "should" be returned from a call to the: Expression.getValue(Object,Query) method. |
com.gentlyweb.utils.Getter |
getGetter()
|
boolean |
hasFixedResult(Query q)
Return whether the expression will evaluate to a fixed/constant result. |
void |
init(Query q)
Perform the necessary initialisation for this expression. |
boolean |
isTrue(Object o,
Query q)
This method allows ANY expression (including those that extend ValueExpression )
to be used in the WHERE and HAVING clauses but ensuring that a boolean value is
available for every expression. |
void |
setAccessor(String a)
|
void |
setName(String name)
|
String |
toString()
Return a string representation of the expression, making this abstract forces sub-classes to provide an implementation. |
Methods inherited from class org.josql.expressions.ValueExpression |
---|
getValue |
Methods inherited from class org.josql.expressions.Expression |
---|
isBracketed, setBracketed |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Accessor()
Method Detail |
---|
public Class getExpectedReturnType(Query q) throws QueryParseException
Expression
Expression.getValue(Object,Query)
method. It may be that repeated executions
of a query will return different classes from this method. In general
sub-classes should take this variance into account.
getExpectedReturnType
in class Expression
q
- The Query object.
Expression.getValue(Object,Query)
method.
QueryParseException
- If something goes wrong with determining the type.public void init(Query q) throws QueryParseException
Expression
init
in class Expression
q
- The Query object.
QueryParseException
- If something goes wrong with the initialisation.public String getAccessor()
public void setAccessor(String a)
public com.gentlyweb.utils.Getter getGetter()
public void setName(String name)
public boolean isTrue(Object o, Query q) throws QueryExecutionException
Expression
ValueExpression
)
to be used in the WHERE and HAVING clauses but ensuring that a boolean value is
available for every expression.
isTrue
in class Expression
o
- The current object to evaluate the expression on.q
- The Query object.
true
if the expression evaluates to true
(well duh...).
QueryExecutionException
- If there is a problem with the execution of the
expression.public boolean hasFixedResult(Query q)
Expression
Expression.isTrue(Object,Query)
or Expression.getValue(Object,Query)
methods will return the same object (or that o1.equals (o2) == true)
regardless of the object passed to the method.
hasFixedResult
in class Expression
q
- The Query object.
true
if the expression evaluates to a fixed/constant result.public Object evaluate(Object o, Query q) throws QueryExecutionException
evaluate
in class ValueExpression
QueryExecutionException
public boolean equals(Object o)
equals
in class Object
public String toString()
Expression
toString
in class Expression
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |