Class LikeFunction

java.lang.Object
com.randomnoun.common.jexl.eval.function.LikeFunction
All Implemented Interfaces:
EvalFunction
Direct Known Subclasses:
LikeFunction

public class LikeFunction extends Object implements EvalFunction
Defines a like() function.

like() takes a two parameters, the string being matched and the SQL LIKE pattern we are matching on. The LIKE pattern uses the "%" character to represent any sequence of characters, and "_" to indicate a single character. This class automatically deals with conflicts with the Java regex parser, so the pattern may contain any other Unicode or regular expression characters, which will be treated like any other character.

The result of the function is of type Boolean.

  • Constructor Details

  • Method Details

    • evaluate

      public Object evaluate(String functionName, EvalContext context, List<Object> arguments) throws EvalException
      Implements the function as per the class description.
      Specified by:
      evaluate in interface EvalFunction
      Parameters:
      functionName - The name of the function to be evaluated (can be disregarded if this class only performs a single function)
      context - The context in which the function is being executed (could hold things like local variable values, current line number, etc...)
      arguments - The arguments passed to this function
      Returns:
      The result of the evaluation
      Throws:
      EvalException - An exception occurred during evaluation