Class RegexFlags

java.lang.Object
org.springframework.data.mongodb.util.RegexFlags

public abstract class RegexFlags extends Object
Utility to translate regex flags to MongoDB regex options and vice versa.
Since:
3.3
Author:
Mark Paluch
  • Method Details

    • toRegexOptions

      public static String toRegexOptions(int flags)
      Lookup the MongoDB specific options from given flags.
      Parameters:
      flags - the Regex flags to look up.
      Returns:
      the options string. May be empty.
    • toRegexFlags

      public static int toRegexFlags(@Nullable String s)
      Lookup the MongoDB specific flags for a given regex option string.
      Parameters:
      s - the Regex option/flag to look up. Can be null.
      Returns:
      zero if given String is null or empty.
      Since:
      2.2
    • toRegexFlag

      public static int toRegexFlag(char c)
      Lookup the MongoDB specific flags for a given character.
      Parameters:
      c - the Regex option/flag to look up.
      Returns:
      Throws:
      IllegalArgumentException - for unknown flags
      Since:
      2.2