Package org.wildfly.security.auth.util
Class RegexNameRewriter
java.lang.Object
org.wildfly.security.auth.util.RegexNameRewriter
- All Implemented Interfaces:
NameRewriter
A simple regular expression-based name rewriter.
-
Field Summary
Fields inherited from interface org.wildfly.security.auth.server.NameRewriter
IDENTITY_REWRITER -
Constructor Summary
ConstructorsConstructorDescriptionRegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the pattern.Get the replacement string.rewriteName(String original) Rewrite a name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.auth.server.NameRewriter
asPrincipalRewriter
-
Constructor Details
-
RegexNameRewriter
Construct a new instance.- Parameters:
pattern- the substitution pattern (must not benull)replacement- the replacement stringreplaceAll-trueto replace all occurrences of the pattern;falseto replace only the first occurrence
-
-
Method Details
-
rewriteName
Rewrite a name. Must not returnnull.- Specified by:
rewriteNamein 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
-