org.apache.activemq.filter.function
Class inListFunction

java.lang.Object
  extended by org.apache.activemq.filter.function.inListFunction
All Implemented Interfaces:
FilterFunction

public class inListFunction
extends Object
implements FilterFunction

Filter function that matches a value against a list of values and evaluates to an indicator of membership in the list. For example:

INLIST( SPLIT('1,2,3', ',') , '2' )

Note that the first argument must be a List. Strings containing lists are not acceptable; for example, INLIST('1,2,3', '1'), will cause an exception to be thrown at evaluation-time.


Constructor Summary
inListFunction()
           
 
Method Summary
 Object evaluate(FunctionCallExpression expr, MessageEvaluationContext message_ctx)
          Evalutate the given expression, which consists of a call to this function, in the context given.
 boolean isValid(FunctionCallExpression expr)
          Check whether the given expression is a valid call of this function.
 boolean returnsBoolean(FunctionCallExpression expr)
          Check whether the given expression, which consists of a call to this function, evaluates to a Boolean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

inListFunction

public inListFunction()
Method Detail

isValid

public boolean isValid(FunctionCallExpression expr)
Check whether the given expression is a valid call of this function. Two arguments are required. Note that the evaluated results of the arguments will be compared with Object#equals().

Specified by:
isValid in interface FilterFunction
Parameters:
expr - - the expression consisting of a call to this function.
Returns:
true - if the expression is valid; false - otherwise.

returnsBoolean

public boolean returnsBoolean(FunctionCallExpression expr)
Check whether the given expression, which consists of a call to this function, evaluates to a Boolean. If the function can return different more than one type of value at evaluation-time, it must decide whether to cast the result to a Boolean at this time.

Specified by:
returnsBoolean in interface FilterFunction
Parameters:
expr - - the expression consisting of a call to this function.
Returns:
true - if the expression is valid; false - otherwise.

evaluate

public Object evaluate(FunctionCallExpression expr,
                       MessageEvaluationContext message_ctx)
                throws JMSException
Evalutate the given expression, which consists of a call to this function, in the context given. Checks whether the second argument is a member of the list in the first argument.

Specified by:
evaluate in interface FilterFunction
Parameters:
expr - - the expression consisting of a call to this function.
message_ctx - - the context in which the call is being evaluated.
Returns:
Boolean - the result of the evaluation.
Throws:
JMSException


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.