org.exolab.jms.selector
Interface ExpressionFactory

All Known Implementing Classes:
DefaultExpressionFactory

public interface ExpressionFactory

This interface specifies the methods needed to create all of the expressions supported by the message selector. It exists solely to decouple the expression evaluation classes from the parser.

Version:
$Revision: 1.4 $ $Date: 2003/08/09 15:49:50 $
Author:
Tim Anderson
See Also:
Expression, SelectorTokenTypes, SelectorTreeParser

Method Summary
 Expression between(Expression num1, Expression num2, Expression num3)
          Create a 'between' expression that returns the result of:
num1 >= num2 and num1 <= num3 when evaluated
 Expression binaryOperator(int operator, Expression left, Expression right)
          Create a binary operator expression
 Expression identifier(java.lang.String name)
          Create an identifier expression
 Expression in(Expression identifier, java.util.HashSet set)
          Create an 'in' expression
 Expression isNull(Expression identifier)
          Create an 'is null' expression
 Expression like(Expression identifier, java.lang.String pattern, java.lang.String escape)
          Create a 'like' expression
 Expression literal(int type, java.lang.String text)
          Create a literal expression
 Expression unaryOperator(int operator, Expression operand)
          Create an unary operator expression
 

Method Detail

binaryOperator

public Expression binaryOperator(int operator,
                                 Expression left,
                                 Expression right)
                          throws SelectorException
Create a binary operator expression
Parameters:
operator - the operator token type from SelectorTokenTypes
left - the left-hand side of the binary expression
right - the right-hand side of the binary expression
Returns:
a new binary expression
Throws:
SelectorException - if the operator is not a valid binary operator

unaryOperator

public Expression unaryOperator(int operator,
                                Expression operand)
                         throws SelectorException
Create an unary operator expression
Parameters:
operator - the operator token type from SelectorTokenTypes
operand - the expression to apply the operator to
Returns:
a new unary expression
Throws:
SelectorException - if the operator is not a valid unary operator

identifier

public Expression identifier(java.lang.String name)
                      throws SelectorException
Create an identifier expression
Parameters:
name - the name of the identifier
Returns:
a new identifier expression
Throws:
SelectorException - is name is not a valid identifier

isNull

public Expression isNull(Expression identifier)
                  throws SelectorException
Create an 'is null' expression
Parameters:
identifier - the identifer expression to apply the 'is null' test
Returns:
an 'is null' expression
Throws:
SelectorException - for any error

like

public Expression like(Expression identifier,
                       java.lang.String pattern,
                       java.lang.String escape)
                throws SelectorException
Create a 'like' expression
Parameters:
identifier - the identifer to apply the 'like' test to
pattern - the search pattern
escape - the escape character. This may be null
Returns:
a new 'like' expression
Throws:
SelectorException - if the pattern or escape is invalid

between

public Expression between(Expression num1,
                          Expression num2,
                          Expression num3)
                   throws SelectorException
Create a 'between' expression that returns the result of:
num1 >= num2 and num1 <= num3 when evaluated
Parameters:
num1 - an arithmethic expression
num2 - an arithmethic expression
num3 - an arithmethic expression
Returns:
a new 'between' expression
Throws:
SelectorException - for any error

in

public Expression in(Expression identifier,
                     java.util.HashSet set)
              throws SelectorException
Create an 'in' expression
Parameters:
identifier - string identifer to apply the 'in' test to
set - the set of string values to compare against
Returns:
a new 'in' expression
Throws:
SelectorException - for any error

literal

public Expression literal(int type,
                          java.lang.String text)
                   throws SelectorException
Create a literal expression
Parameters:
type - the operator token type from SelectorTokenTypes
text - the literal text
Returns:
a new literal expression
Throws:
SelectorException - if type is not a valid literal type


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.