org.exolab.jms.selector
Class DefaultExpressionFactory

java.lang.Object
  |
  +--org.exolab.jms.selector.DefaultExpressionFactory
All Implemented Interfaces:
ExpressionFactory

public final class DefaultExpressionFactory
extends java.lang.Object
implements ExpressionFactory

Default implementation of ExpressionFactory

Version:
$Revision: 1.1 $ $Date: 2004/11/26 01:50:44 $
Author:
Tim Anderson
See Also:
ExpressionFactory, SelectorTokenTypes

Constructor Summary
DefaultExpressionFactory()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExpressionFactory

public DefaultExpressionFactory()
Method Detail

binaryOperator

public Expression binaryOperator(int operator,
                                 Expression left,
                                 Expression right)
                          throws SelectorException
Create a binary operator expression
Specified by:
binaryOperator in interface ExpressionFactory
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
Specified by:
unaryOperator in interface ExpressionFactory
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
Specified by:
identifier in interface ExpressionFactory
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
Specified by:
isNull in interface ExpressionFactory
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
Specified by:
like in interface ExpressionFactory
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
Specified by:
between in interface ExpressionFactory
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
Specified by:
in in interface ExpressionFactory
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
Specified by:
literal in interface ExpressionFactory
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-2007 The OpenJMS Group. All Rights Reserved.