Package org.wildfly.security.auth.util
Class RegexNameRewriter
- java.lang.Object
 - 
- org.wildfly.security.auth.util.RegexNameRewriter
 
 
- 
- All Implemented Interfaces:
 NameRewriter
public final class RegexNameRewriter extends Object implements NameRewriter
A simple regular expression-based name rewriter. 
- 
- 
Field Summary
- 
Fields inherited from interface org.wildfly.security.auth.server.NameRewriter
IDENTITY_REWRITER 
 - 
 
- 
Constructor Summary
Constructors Constructor Description RegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll)Construct a new instance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PatterngetPattern()Get the pattern.StringgetReplacement()Get the replacement string.StringrewriteName(String original)Rewrite a name.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.wildfly.security.auth.server.NameRewriter
asPrincipalRewriter 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RegexNameRewriter
public RegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll)
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 Detail
- 
rewriteName
public String rewriteName(String original)
Rewrite a name. Must not returnnull.- Specified by:
 rewriteNamein interfaceNameRewriter- 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
 
 
 - 
 
 -