Home Manual Reference Source
public class | source

AddressTemplate

Template for a DMR address which might contain multiple variable parts.

An address template can be defined using the following BNF:

<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 {@link StatementContext}.

Example:

AddressTemplate a2 = AddressTemplate.of("{selected.profile}");
AddressTemplate a3 = AddressTemplate.of("{selected.profile}/subsystem=mail");
AddressTemplate a4 = AddressTemplate.of("{selected.profile}/subsystem=mail/mail-session=*");

Static Member Summary

Static Public Members
public static get

The root template

Static Method Summary

Static Public Methods
public static

of(template: *)

Creates a new address template from an encoded string template.

Member Summary

Public Members
public get
public get
public get
public get
public get
public get
public get

Method Summary

Public Methods
public

Append an address to this addrress template and return a new one.

public

resolve(context: StatementContext, wildcards: ...string): ResourceAddress

Resolve this address template against the specified statement context.

public

Static Public Members

public static get ROOT source

The root template

Static Public Methods

public static of(template: *) source

Creates a new address template from an encoded string template.

Params:

NameTypeAttributeDescription
template *

Public Members

public get empty: boolean source

Return:

boolean

true if this template contains no tokens, false otherwise

public get firstName: string source

Return:

string

the name of the first segment or null if this address template is empty.

public get firstValue: string source

Return:

string

the value of the first segment or null if this address template is empty.

public get lastName: string source

Return:

string

the name of the last segment or null if this address template is empty.

public get lastValue: string source

Return:

string

the value of the last segment or null if this address template is empty.

public get parent: AddressTemplate source

Return:

AddressTemplate

the parent address template or the root template

public get size: number source

Return:

number

the number of tokens

Public Methods

public append(address: string | AddressTemplate): AddressTemplate source

Append an address to this addrress template and return a new one.

Params:

NameTypeAttributeDescription
address string | AddressTemplate

The address to append.

Return:

AddressTemplate

a new address template with the specified address added at the end.

public resolve(context: StatementContext, wildcards: ...string): ResourceAddress source

Resolve this address template against the specified statement context.

Params:

NameTypeAttributeDescription
context StatementContext

the statement context

wildcards ...string

An optional list of wildcards which are used to resolve any wildcards in this address template from left to right

Return:

ResourceAddress

a fully qualified resource address which might be empty, but which does not contain any tokens

public toString(): string source

Return:

string

the string representation of this address template