Class RegexNameRewriter

java.lang.Object
org.infinispan.security.mappers.RegexNameRewriter
All Implemented Interfaces:
NameRewriter

public final class RegexNameRewriter extends Object implements NameRewriter
A simple regular expression-based name rewriter.
  • Constructor Details

    • RegexNameRewriter

      public RegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll)
      Construct a new instance.
      Parameters:
      pattern - the substitution pattern (must not be null)
      replacement - the replacement string
      replaceAll - true to replace all occurrences of the pattern; false to replace only the first occurrence
  • Method Details

    • rewriteName

      public String rewriteName(String original)
      Rewrite a name. Must not return null.
      Specified by:
      rewriteName in interface NameRewriter
      Parameters:
      original - the original name
      Returns:
      the rewritten name
    • getPattern

      public Pattern getPattern()
      Get the pattern.
      Returns:
      the pattern
    • getReplacement

      public String getReplacement()
      Get the replacement string.
      Returns:
      the replacement string
    • isReplaceAll

      public boolean isReplaceAll()
      Whether this rewriter replaces all occurrences of the patter or just the first