Class replaceFunction
java.lang.Object
org.apache.activemq.filter.function.replaceFunction
- All Implemented Interfaces:
FilterFunction
Function which replaces regular expression matches in a source string to a replacement literal.
For Example:
REPLACE('1,2/3', '[,/]', ';') returns '1;2;3'
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate
(FunctionCallExpression expr, MessageEvaluationContext message_ctx) Evaluate the given expression for this function in the given context.boolean
Check whether the given expression is valid for this function.boolean
Indicate that this function does not return a boolean value.
-
Constructor Details
-
replaceFunction
public replaceFunction()
-
-
Method Details
-
isValid
Check whether the given expression is valid for this function.- Specified by:
isValid
in interfaceFilterFunction
- Parameters:
expr
- - the expression consisting of a call to this function.- Returns:
- true - if three arguments are passed to the function; false - otherwise.
-
returnsBoolean
Indicate that this function does not return a boolean value.- Specified by:
returnsBoolean
in interfaceFilterFunction
- Parameters:
expr
- - the expression consisting of a call to this function.- Returns:
- false - this filter function always evaluates to a string.
-
evaluate
public Object evaluate(FunctionCallExpression expr, MessageEvaluationContext message_ctx) throws jakarta.jms.JMSException Evaluate the given expression for this function in the given context. The result of the evaluation is a string with all matches of the regular expression, from the evaluation of the second argument, replaced by the string result from the evaluation of the third argument. Replacement is performed by String#replaceAll(). Note that all three arguments must be Strings.- Specified by:
evaluate
in interfaceFilterFunction
- Parameters:
expr
- - the expression consisting of a call to this function.message_ctx
- - the context within which to evaluate the call.- Returns:
- String - the result of the replacement.
- Throws:
jakarta.jms.JMSException
-