Package org.infinispan.security.mappers
Class RegexNameRewriter
java.lang.Object
org.infinispan.security.mappers.RegexNameRewriter
- All Implemented Interfaces:
NameRewriter
A simple regular expression-based name rewriter.
-
Field Summary
Fields inherited from interface org.infinispan.security.mappers.NameRewriter
IDENTITY_REWRITER
-
Constructor Summary
ConstructorDescriptionRegexNameRewriter
(Pattern pattern, String replacement, boolean replaceAll) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the pattern.Get the replacement string.boolean
Whether this rewriter replaces all occurrences of the patter or just the firstrewriteName
(String original) Rewrite a name.
-
Constructor Details
-
RegexNameRewriter
Construct a new instance.- Parameters:
pattern
- the substitution pattern (must not benull
)replacement
- the replacement stringreplaceAll
-true
to replace all occurrences of the pattern;false
to replace only the first occurrence
-
-
Method Details
-
rewriteName
Rewrite a name. Must not returnnull
.- Specified by:
rewriteName
in interfaceNameRewriter
- Parameters:
original
- the original name- Returns:
- the rewritten name
-
getPattern
Get the pattern.- Returns:
- the pattern
-
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
-