public class RegexRequestURLBuilder extends Object implements com.google.common.base.Function<String,String>
The function uses standard Java regular expression components from the java.util.regex
package.
It is therefore helpful to have an understanding of the use of these Java classes.
The runtime logic is effectively:
Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(entityID); if (matcher.matches()) { return matcher.replaceAll(replacement); else { return null; }
For supported regular expression syntax see Pattern
. For details on the replacement operation,
see Matcher.replaceAll(String)
.
It is expected that the typical use case is that the supplied replacement string will be a combination of literal text combined with back references to the regular expression match groups, e.g. $1, $2, etc.
If the regular expression does not match the entity ID, or if there is an error in evaluating the regular expression, then null is returned.
Constructor and Description |
---|
RegexRequestURLBuilder(String regex,
String replacement)
Constructor.
|
Copyright © 2016 JBoss by Red Hat. All rights reserved.