Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.josql.expressions
Class Accessor  view Accessor download Accessor.java

java.lang.Object
  extended byorg.josql.expressions.Expression
      extended byorg.josql.expressions.ValueExpression
          extended byorg.josql.expressions.Accessor

public class Accessor
extends ValueExpression

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.

Last Modified By: $Author: barrygently $
Last Modified On: $Date: 2005/04/28 05:48:59 $
Current Revision: $Revision: 1.4 $


Field Summary
private  java.lang.String acc
           
private  Getter get
           
 
Fields inherited from class org.josql.expressions.Expression
 
Constructor Summary
Accessor()
           
 
Method Summary
 java.lang.Object evaluate(java.lang.Object o, org.josql.Query q)
           
 java.lang.String getAccessor()
           
 java.lang.Class getExpectedReturnType(org.josql.Query q)
          Return the class of the object that "should" be returned from a call to the: ValueExpression.getValue(Object,Query) 55 method.
 Getter getGetter()
           
 boolean hasFixedResult(org.josql.Query q)
          Return whether the expression will evaluate to a fixed/constant result.
 void init(org.josql.Query q)
          Perform the necessary initialisation for this expression.
 boolean isTrue(java.lang.Object o, org.josql.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(java.lang.String a)
           
 void setName(java.lang.String name)
           
 java.lang.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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

acc

private java.lang.String acc

get

private Getter get
Constructor Detail

Accessor

public Accessor()
Method Detail

getExpectedReturnType

public java.lang.Class getExpectedReturnType(org.josql.Query q)
                                      throws org.josql.QueryParseException
Description copied from class: Expression
Return the class of the object that "should" be returned from a call to the: Expression.getValue(Object,Query) 55 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.

Specified by:
getExpectedReturnType in class Expression

init

public void init(org.josql.Query q)
          throws org.josql.QueryParseException
Description copied from class: Expression
Perform the necessary initialisation for this expression. The exact operations performed are defined by the sub-class.

Specified by:
init in class Expression

getAccessor

public java.lang.String getAccessor()

setAccessor

public void setAccessor(java.lang.String a)

getGetter

public Getter getGetter()

setName

public void setName(java.lang.String name)

isTrue

public boolean isTrue(java.lang.Object o,
                      org.josql.Query q)
               throws org.josql.QueryExecutionException
Description copied from class: Expression
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.

Specified by:
isTrue in class Expression

hasFixedResult

public boolean hasFixedResult(org.josql.Query q)
Description copied from class: Expression
Return whether the expression will evaluate to a fixed/constant result. This allows certain optimisations to be performed when an expression is evaluated. A "fixed result" is basically one in which multiple calls to either the: Expression.isTrue(Object,Query) 55 or Expression.getValue(Object,Query) 55 methods will return the same object (or that o1.equals (o2) == true) regardless of the object passed to the method.

Specified by:
hasFixedResult in class Expression

evaluate

public java.lang.Object evaluate(java.lang.Object o,
                                 org.josql.Query q)
                          throws org.josql.QueryExecutionException
Specified by:
evaluate in class ValueExpression

toString

public java.lang.String toString()
Description copied from class: Expression
Return a string representation of the expression, making this abstract forces sub-classes to provide an implementation.

Specified by:
toString in class Expression