public class AddressTemplate extends Object implements Comparable<AddressTemplate>
<address template> ::= "/" | <segment>
<segment> ::= <tuple> | <segment>"/"<tuple>
<tuple> ::= <variable> | <key>"="<value>
<variable> ::= "{"<alpha>"}"
<key> ::= <alpha>
<value> ::= <variable> | <alpha> | "*"
<alpha> ::= <upper> | <lower>
<upper> ::= "A" | "B" | … | "Z"
<lower> ::= "a" | "b" | … | "z"
Here are some examples for address templates:
AddressTemplate a1 = AddressTemplate.of("/");
AddressTemplate a2 = AddressTemplate.of("{selected.profile}");
AddressTemplate a3 = AddressTemplate.of("{selected.profile}/subsystem=mail");
AddressTemplate a4 = AddressTemplate.of("{selected.profile}/subsystem=mail/mail-session=*");
To resolve a fully qualified address from an address template use the resolve(StatementContext, String...) method.| Modifier and Type | Method and Description |
|---|---|
AddressTemplate |
append(String template)
Appends the specified template to this template and returns a new template.
|
int |
compareTo(AddressTemplate o) |
boolean |
equals(Object o) |
String |
getResourceName() |
String |
getResourceType()
Returns the resource type of the last segment for this address template
|
String |
getTemplate() |
int |
hashCode() |
boolean |
isOptional() |
AddressTemplate |
lastSubTemplate() |
static AddressTemplate |
of(String template) |
AddressTemplate |
replaceWildcards(String wildcard,
String... wildcards)
Replaces one or more wildcards with the specified values starting from left to right and returns a new
address template.
|
ResourceAddress |
resolve(StatementContext context,
String... wildcards)
Resolve this address template against the specified statement context.
|
ResourceAddress |
resolve(String... wildcards) |
AddressTemplate |
subTemplate(int fromIndex,
int toIndex)
Works like
List.subList(int, int) over the tokens of this template and throws the same exceptions. |
Integer |
tokenLength() |
String |
toString() |
public static AddressTemplate of(String template)
public Integer tokenLength()
public AddressTemplate append(String template)
template - the template to append (makes no difference whether it starts with "/" or not)public AddressTemplate subTemplate(int fromIndex, int toIndex)
List.subList(int, int) over the tokens of this template and throws the same exceptions.fromIndex - low endpoint (inclusive) of the sub templatetoIndex - high endpoint (exclusive) of the sub templateIndexOutOfBoundsException - for an illegal endpoint index value
(fromIndex < 0 || toIndex > size ||
fromIndex > toIndex)public AddressTemplate lastSubTemplate()
public AddressTemplate replaceWildcards(String wildcard, String... wildcards)
wildcard - the first wildcard (mandatory)wildcards - more wildcards (optional)public String getResourceType()
public String getResourceName()
public String getTemplate()
public boolean isOptional()
public ResourceAddress resolve(String... wildcards)
public ResourceAddress resolve(StatementContext context, String... wildcards)
context - the statement contextwildcards - An optional list of wildcards which are used to resolve any wildcards in this address templatepublic int compareTo(AddressTemplate o)
compareTo in interface Comparable<AddressTemplate>Copyright © 2017 JBoss by Red Hat. All rights reserved.