public class ResourceIdentifier
extends java.lang.Object
elements are uniquely addressable resourcesgroups may contain multiple elementsextensions may provided additional information for elementsgroup1/id1/group2/id2/extension.
The scope of a resource identifier is a pair of group and an optional element identifier or the address of an extension.
In the example above we see three scopes:
group1/id1group2/id2extension| Modifier and Type | Method and Description |
|---|---|
java.lang.String[] |
completeHierarchy()
Returns a copy the complete group and extension hierarchy.
|
boolean |
empty()
Returns
true if this resource identifier is empty, otherwise false. |
ResourceIdentifier |
extend(Element element)
Extends the current resource identifier by the specified element
Addressable.address(). |
ResourceIdentifier |
extend(java.lang.String extension)
Extends the current resource identifier by the specified extension.
|
java.lang.String[] |
extendedHierarchy(java.lang.String extension)
Extends the hierarchy of the current scope by the specified extensions and returns it.
|
java.util.Collection<java.lang.String> |
extensions()
Returns all extensions as specified by the
show query parameter. |
Filters |
filters()
Returns the filters instance for the current scope of
this resource identifier. |
java.lang.String[] |
get()
Returns a copy of the complete parsed URI.
|
java.lang.String |
groupIdentifier()
Returns the group identifier.
|
boolean |
hasElementIdentifier()
Returns
true if there is an element identifier in the current scope, otherwise false. |
boolean |
hasNextScope()
Returns
true if their are more scopes available, otherwise false. |
java.lang.String[] |
hierarchy()
Returns the hierarchy for the current scope.
|
ResourceIdentifier |
next()
Returns the resource identifier for the next scope.
|
static ResourceIdentifier |
parse(java.lang.String uri)
Parses the specified URI and returns the resource identifier.
|
static ResourceIdentifier |
parse(java.lang.String uri,
com.google.common.collect.Multimap<java.lang.String,java.lang.String> parameters)
Parses the specified URI and returns the resource identifier.
|
public static ResourceIdentifier parse(java.lang.String uri)
uri - the URI to parsepublic static ResourceIdentifier parse(java.lang.String uri, com.google.common.collect.Multimap<java.lang.String,java.lang.String> parameters)
uri - the URI to parseparameters - the request parameterspublic java.lang.String[] get()
public boolean empty()
true if this resource identifier is empty, otherwise false.true if this resource identifier is empty, otherwise falsepublic java.lang.String[] hierarchy()
next().completeHierarchy()public java.lang.String[] extendedHierarchy(java.lang.String extension)
extension - the extension namehierarchy()public java.lang.String[] completeHierarchy()
group1/id1/group2/id2/extension will return group1/group2/extension.public boolean hasNextScope()
true if their are more scopes available, otherwise false.true if their are more scopes available, otherwise falsepublic ResourceIdentifier next()
group1/id1/group2/id2/extension has three scopes:
group1/id1group2/id2extensionpublic boolean hasElementIdentifier()
true if there is an element identifier in the current scope, otherwise false.true if there is an element identifier in the current scope, otherwise falsepublic java.lang.String groupIdentifier()
public ResourceIdentifier extend(java.lang.String extension)
IllegalArgumentException will be thrown instead.extension - the extension namepublic ResourceIdentifier extend(Element element)
Addressable.address().
The current resource identifier can only be extended if no element identifier (see hasElementIdentifier()).
If this resource identifier should be extended by an element and an element identifier already exists an
IllegalArgumentException will be thrown.element - the element to use for the extensionpublic java.util.Collection<java.lang.String> extensions()
show query parameter.