org.apache.jdo.jdoql.tree
Interface ExpressionFactory

All Known Subinterfaces:
QueryTree
All Known Implementing Classes:
Tree

public interface ExpressionFactory

This interface provides methods for factorizing expression nodes. Expression nodes are used as filter expressions for query trees.

Author:
Michael Watzek

Method Summary
 AndExpression newAnd(Expression left, Expression right)
          Returns an and expression for the arguments left and right.
 CastExpression newCast(java.lang.Class clazz, Expression expression)
          Returns an instance of CastExpression.
 ComplementExpression newComplement(Expression expr)
          Returns a complement expression for the argument expr.
 ConditionalAndExpression newConditionalAnd(Expression left, Expression right)
          Returns a conditional and expression for the arguments left and right.
 ConditionalOrExpression newConditionalOr(Expression left, Expression right)
          Returns a conditional or expression for the arguments left and right.
 ConstantExpression newConstant(boolean b)
          Returns an instance of BooleanLiteralExpression.
 ConstantExpression newConstant(byte b)
          Returns an instance of ByteLiteralExpression.
 ConstantExpression newConstant(char c)
          Returns an instance of CharLiteralExpression.
 ConstantExpression newConstant(double d)
          Returns an instance of DoubleLiteralExpression.
 ConstantExpression newConstant(float f)
          Returns an instance of FloatLiteralExpression.
 ConstantExpression newConstant(int i)
          Returns an instance of IntLiteralExpression.
 ConstantExpression newConstant(long l)
          Returns an instance of LongLiteralExpression.
 ConstantExpression newConstant(java.lang.Object value)
          Returns an instance of ConstantExpression.
 ConstantExpression newConstant(short s)
          Returns an instance of ShortLiteralExpression.
 DivideExpression newDivide(Expression left, Expression right)
          Returns a divide expression for the arguments left and right.
 EqualsExpression newEquals(Expression left, Expression right)
          Returns an equals expression for the arguments left and right.
 StaticFieldAccessExpression newFieldAccess(java.lang.Class clazz, java.lang.String fieldName)
          Returns an instance of StaticFieldAccessExpression.
 FieldAccessExpression newFieldAccess(Expression target, java.lang.String fieldName)
          Returns an instance of FieldAccessExpression.
 GreaterThanExpression newGreaterThan(Expression left, Expression right)
          Returns a greater than expression for the arguments left and right.
 GreaterThanEqualsExpression newGreaterThanEquals(Expression left, Expression right)
          Returns a greater than equals expression for the arguments left and right.
 IdentifierExpression newIdentifier(java.lang.String identifier)
          The implementation may decide to create an instance of FieldAccessExpression, VariableAccessExpression or ParameterAccessExpression depending on the fact whether the argument corresponds with a parameter, variable or a field of the candidate class.
 LessThanExpression newLessThan(Expression left, Expression right)
          Returns a less than expression for the arguments left and right.
 LessThanEqualsExpression newLessThanEquals(Expression left, Expression right)
          Returns a less than equals expression for the arguments left and right.
 MethodCallExpression newMethodCall(Expression target, java.lang.String methodName, Expression[] arguments)
          The implementation may decide to create a specialized instance of MethodCallExpression (for example, ContainsCallExpression) depending on the argument methodName.
 UnaryMinusExpression newMinus(Expression expr)
          Returns a unary minus expression for the argument expr.
 MinusExpression newMinus(Expression left, Expression right)
          Returns a minus expression for the arguments left and right.
 NotExpression newNot(Expression expr)
          Returns a not expression for the argument expr.
 NotEqualsExpression newNotEquals(Expression left, Expression right)
          Returns a not equals expression for the arguments left and right.
 OrExpression newOr(Expression left, Expression right)
          Returns an or expression for the arguments left and right.
 UnaryPlusExpression newPlus(Expression expr)
          Returns a plus expression for the argument expr.
 PlusExpression newPlus(Expression left, Expression right)
          Returns a plus expression for the arguments left and right.
 TimesExpression newTimes(Expression left, Expression right)
          Returns a times expression for the arguments left and right.
 

Method Detail

newIdentifier

public IdentifierExpression newIdentifier(java.lang.String identifier)
The implementation may decide to create an instance of FieldAccessExpression, VariableAccessExpression or ParameterAccessExpression depending on the fact whether the argument corresponds with a parameter, variable or a field of the candidate class. Optionally, the implementation may return an instance of IdentifierExpression which later may be replaced with its specialized counterpart semantically analysing a query tree.

Parameters:
identifier - the name of the identifier access expression
Returns:
the identifier access expression instance

newFieldAccess

public FieldAccessExpression newFieldAccess(Expression target,
                                            java.lang.String fieldName)
Returns an instance of FieldAccessExpression.

Parameters:
target - the target expression of the field access expression
fieldName - the name of the field to access
Returns:
the field access expression instance

newFieldAccess

public StaticFieldAccessExpression newFieldAccess(java.lang.Class clazz,
                                                  java.lang.String fieldName)
Returns an instance of StaticFieldAccessExpression.

Parameters:
clazz - the class instance defining the field
fieldName - the name of the field to access
Returns:
the static field access expression instance

newMethodCall

public MethodCallExpression newMethodCall(Expression target,
                                          java.lang.String methodName,
                                          Expression[] arguments)
The implementation may decide to create a specialized instance of MethodCallExpression (for example, ContainsCallExpression) depending on the argument methodName. Optionally, the implementation may return an instance of MethodCallExpression which later may be replaced with its specialized counterpart semantically analysing a query tree.

Parameters:
target - the target expression of the method call expression
methodName - the name of the method
arguments - the array of arguments
Returns:
the specialized method call expression instance

newCast

public CastExpression newCast(java.lang.Class clazz,
                              Expression expression)
Returns an instance of CastExpression.

Parameters:
clazz - the Java class to cast the argument expression to
expression - the expression to cast
Returns:
the cast expression instance

newConstant

public ConstantExpression newConstant(boolean b)
Returns an instance of BooleanLiteralExpression.

Parameters:
b - the value wrapped by the boolean expression
Returns:
the boolean expression instance

newConstant

public ConstantExpression newConstant(byte b)
Returns an instance of ByteLiteralExpression.

Parameters:
b - the value wrapped by the byte expression
Returns:
the byte expression instance

newConstant

public ConstantExpression newConstant(char c)
Returns an instance of CharLiteralExpression.

Parameters:
c - the value wrapped by the char expression
Returns:
the char expression instance

newConstant

public ConstantExpression newConstant(double d)
Returns an instance of DoubleLiteralExpression.

Parameters:
d - the value wrapped by the double expression
Returns:
the double expression instance

newConstant

public ConstantExpression newConstant(float f)
Returns an instance of FloatLiteralExpression.

Parameters:
f - the value wrapped by the float expression
Returns:
the float expression instance

newConstant

public ConstantExpression newConstant(int i)
Returns an instance of IntLiteralExpression.

Parameters:
i - the value wrapped by the int expression
Returns:
the int expression instance

newConstant

public ConstantExpression newConstant(long l)
Returns an instance of LongLiteralExpression.

Parameters:
l - the value wrapped by the long expression
Returns:
the long expression instance

newConstant

public ConstantExpression newConstant(short s)
Returns an instance of ShortLiteralExpression.

Parameters:
s - the value wrapped by the short expression
Returns:
the short expression instance

newConstant

public ConstantExpression newConstant(java.lang.Object value)
Returns an instance of ConstantExpression. This method handles null as a constant expression.

Parameters:
value - the object wrapped by the constant expression
Returns:
the constant expression instance

newComplement

public ComplementExpression newComplement(Expression expr)
Returns a complement expression for the argument expr.

Parameters:
expr - the expression argument for the operation
Returns:
the complement expression instance

newMinus

public UnaryMinusExpression newMinus(Expression expr)
Returns a unary minus expression for the argument expr.

Parameters:
expr - the expression argument for the operation
Returns:
the unary minus expression instance

newNot

public NotExpression newNot(Expression expr)
Returns a not expression for the argument expr.

Parameters:
expr - the expression argument for the operation
Returns:
the not expression instance

newPlus

public UnaryPlusExpression newPlus(Expression expr)
Returns a plus expression for the argument expr.

Parameters:
expr - the expression argument for the operation
Returns:
the plus expression instance

newAnd

public AndExpression newAnd(Expression left,
                            Expression right)
Returns an and expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the and expression instance

newConditionalAnd

public ConditionalAndExpression newConditionalAnd(Expression left,
                                                  Expression right)
Returns a conditional and expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the conditional and expression instance

newConditionalOr

public ConditionalOrExpression newConditionalOr(Expression left,
                                                Expression right)
Returns a conditional or expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the conditional or expression instance

newDivide

public DivideExpression newDivide(Expression left,
                                  Expression right)
Returns a divide expression for the arguments left and right. This method throws NullPointerException if one of the arguments left or right are null.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the divide expression instance

newEquals

public EqualsExpression newEquals(Expression left,
                                  Expression right)
Returns an equals expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the equals expression instance

newGreaterThan

public GreaterThanExpression newGreaterThan(Expression left,
                                            Expression right)
Returns a greater than expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the greater than expression instance

newGreaterThanEquals

public GreaterThanEqualsExpression newGreaterThanEquals(Expression left,
                                                        Expression right)
Returns a greater than equals expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the greater than equals expression instance

newLessThan

public LessThanExpression newLessThan(Expression left,
                                      Expression right)
Returns a less than expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the less than expression instance

newLessThanEquals

public LessThanEqualsExpression newLessThanEquals(Expression left,
                                                  Expression right)
Returns a less than equals expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the less than equals expression instance

newMinus

public MinusExpression newMinus(Expression left,
                                Expression right)
Returns a minus expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the minus expression instance

newNotEquals

public NotEqualsExpression newNotEquals(Expression left,
                                        Expression right)
Returns a not equals expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the not equals expression instance

newPlus

public PlusExpression newPlus(Expression left,
                              Expression right)
Returns a plus expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the plus expression instance

newOr

public OrExpression newOr(Expression left,
                          Expression right)
Returns an or expression for the arguments left and right. This method throws NullPointerException if one of the arguments left or right are null.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the or expression instance

newTimes

public TimesExpression newTimes(Expression left,
                                Expression right)
Returns a times expression for the arguments left and right.

Parameters:
left - the left expression argument for the operation
right - the right expression argument for the operation
Returns:
the times expression instance


Copyright © 2005 Apache Software Foundation. All Rights Reserved.