Class BetweenMatcher

java.lang.Object
io.higson.runtime.engine.matchers.BetweenMatcher
All Implemented Interfaces:
Matcher

public class BetweenMatcher extends Object implements Matcher

Range matcher, checks if value fits in range defined in pattern. Value type and pattern type must also match. It is possible to define range inclusiveness or exclusiveness, separately for each of range border value.

Between matcher has a set of default separators, that will be used to separate values for beginning and end of range. These separators are (order matters):
 : -
 
Since:
0.9.0
Author:
Przemek Hertel
  • Constructor Details

    • BetweenMatcher

      public BetweenMatcher(boolean lowerInclusive, boolean upperInclusive, BetweenMatcherTokenSeparator tokenSeparator)
    • BetweenMatcher

      public BetweenMatcher(boolean lowerInclusive, boolean upperInclusive, String separators)
    • BetweenMatcher

      public BetweenMatcher(boolean lowerInclusive, boolean upperInclusive)
  • Method Details

    • matches

      public <T extends ValueHolder> boolean matches(String value, String pattern, Type<T> type)
      Description copied from interface: Matcher
      Check if value matches the pattern. Type can be used to parse value or to differentiate matchers behavior depending on value type. Type is defined per parameter Level.
      Specified by:
      matches in interface Matcher
      Type Parameters:
      T - level type
      Parameters:
      value - value form query (provided by user)
      pattern - pattern from parameter matrix (can be '*')
      type - type of value, might be null if none was set
      Returns:
      true if value matched, false otherwise
    • tokenSeparator

      public BetweenMatcherTokenSeparator tokenSeparator()