public final class URIResolver extends Object
// Create a resolver instance URIResolver resolver = new URIResolver("http://www.acme.com/test/home"); // Find the matching pattern amongst a list of precompiled URI patterns URIPattern pattern = resolver.find(patterns); // Resolve the URI for the specified pattern, the result holds all the matching info URIResolveResult result = resolver.resolve(p);
Modifier and Type | Class and Description |
---|---|
static class |
URIResolver.MatchRule
Defines the priority rule for matching patterns.
|
Constructor and Description |
---|
URIResolver(String uri)
Creates a new resolver for the specified URI.
|
Modifier and Type | Method and Description |
---|---|
URIPattern |
find(List<URIPattern> patterns)
Returns the first URI pattern in the list which matches the underlying URI.
|
URIPattern |
find(List<URIPattern> patterns,
URIResolver.MatchRule rule)
Returns the first URI pattern in the list which matches the underlying URI.
|
Collection<URIPattern> |
findAll(List<URIPattern> patterns)
Returns all the URI patterns in the list which match the underlying URI.
|
URIResolveResult |
resolve(URIPattern pattern)
Resolves the given URI pattern.
|
URIResolveResult |
resolve(URIPattern pattern,
VariableBinder binder)
Resolves the given URI pattern using the specified variable binder.
|
String |
uri()
Returns the URI handled by this resolver.
|
public URIResolver(String uri)
uri
- The URI to resolve.public String uri()
public URIPattern find(List<URIPattern> patterns)
patterns
- The URI patterns available.null
.public URIPattern find(List<URIPattern> patterns, URIResolver.MatchRule rule)
patterns
- The URI patterns available.rule
- The rule used to select the matching patterns in case of multiple matches.null
.public Collection<URIPattern> findAll(List<URIPattern> patterns)
patterns
- The URI patterns available.public URIResolveResult resolve(URIPattern pattern)
pattern
- The pattern to resolve.public URIResolveResult resolve(URIPattern pattern, VariableBinder binder)
pattern
- The pattern to resolve.binder
- The variable binder.Copyright © 2016 Allette Systems. All rights reserved.