@JsType(namespace="hal.meta") public final class AddressTemplate extends Object implements Iterable<String>
<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"
Following variables are supported:
- {domain.controller}
- {selected.profile}
- {selected.group}
- {selected.server-config}
- {selected.server}
To get a fully qualified address from an address template use the method resolve(). For standalone mode
the variables will resolve to an empty string. The values of the variables are managed by the StatementContext.| Modifier and Type | Class and Description |
|---|---|
static interface |
AddressTemplate.Unresolver |
| Modifier and Type | Field and Description |
|---|---|
static String |
EQUALS |
static String |
OPTIONAL |
static AddressTemplate |
ROOT
The root template
|
| Modifier and Type | Method and Description |
|---|---|
AddressTemplate |
append(AddressTemplate template) |
AddressTemplate |
append(String template)
Appends the specified encoded template to this template and returns a new template.
|
boolean |
equals(Object o) |
String |
firstName() |
String |
firstValue() |
AddressTemplate |
getParent() |
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isOptional() |
@NotNull Iterator<String> |
iterator() |
AddressTemplate |
jsAppend(Object address)
Append an address to this addrress template and return a new one.
|
String |
lastName() |
String |
lastValue() |
static AddressTemplate |
of(ResourceAddress address)
Turns a resource address into an address template which is the opposite of
resolve(StatementContext,
String...). |
static AddressTemplate |
of(ResourceAddress address,
AddressTemplate.Unresolver unresolver)
Turns a resource address into an address template which is the opposite of
resolve(StatementContext,
String...). |
static AddressTemplate |
of(StatementContext.Tuple placeholder)
Creates a new address template from a well known placeholder.
|
static AddressTemplate |
of(StatementContext.Tuple placeholder1,
StatementContext.Tuple placeholder2)
Creates a new address template from two placeholders.
|
static AddressTemplate |
of(StatementContext.Tuple placeholder1,
StatementContext.Tuple placeholder2,
String template)
Creates a new address template from two placeholders and an encoded string template.
|
static AddressTemplate |
of(StatementContext.Tuple placeholder,
String template)
Creates a new address template from a placeholder and an encoded string template.
|
static AddressTemplate |
of(String template)
Creates a new address template from an encoded 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.
|
int |
size() |
AddressTemplate |
subTemplate(int fromIndex,
int toIndex)
Works like
List.subList(int, int) over the tokens of this template and throws the same exceptions. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final AddressTemplate ROOT
public static final String EQUALS
@JsIgnore public static final String OPTIONAL
@JsIgnore public static AddressTemplate of(StatementContext.Tuple placeholder)
@JsIgnore public static AddressTemplate of(StatementContext.Tuple placeholder, @NonNls String template)
ModelNodeHelper.encodeValue(String).@JsIgnore public static AddressTemplate of(StatementContext.Tuple placeholder1, StatementContext.Tuple placeholder2)
@JsIgnore public static AddressTemplate of(StatementContext.Tuple placeholder1, StatementContext.Tuple placeholder2, @NonNls String template)
ModelNodeHelper.encodeValue(String).public static AddressTemplate of(@NonNls String template)
@JsIgnore public static AddressTemplate of(ResourceAddress address)
resolve(StatementContext,
String...).@JsIgnore public static AddressTemplate of(ResourceAddress address, AddressTemplate.Unresolver unresolver)
resolve(StatementContext,
String...). Use the AddressTemplate.Unresolver function to specify how the segments of the resource address are
"unresolved". It is called for each segment of the specified resource address.public String toString()
@JsProperty public boolean isEmpty()
@JsProperty(name="size") public int size()
@JsIgnore public AddressTemplate append(@NonNls String template)
ModelNodeHelper.encodeValue(String).template - the encoded template to append (makes no difference whether it starts with '/' or not)@JsIgnore public AddressTemplate append(AddressTemplate template)
@JsIgnore 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)@JsProperty public AddressTemplate getParent()
@JsIgnore public AddressTemplate replaceWildcards(String wildcard, String... wildcards)
This method does not resolve the address template. The returned template is still unresolved.
wildcard - the first wildcard (mandatory)wildcards - more wildcards (optional)@JsProperty(name="firstName") public String firstName()
@JsProperty(name="firstValue") public String firstValue()
@JsProperty(name="lastName") public String lastName()
@JsProperty(name="lastValue") public String lastValue()
@JsIgnore public boolean isOptional()
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 template
from left to right@JsMethod(name="append") public AddressTemplate jsAppend(Object address)
address - The address to append.Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.