public class BindingSet<T> extends Object implements Iterable<Map.Entry<UriPattern,T>>
This is an immutable set of ordered bindings from UriPattern
s to some target type T. To create an instance
of this class, you must 1) create a BindingRepository
, 2) configure it using the BindingRepository.bind(String, Object)
method, and finally 3) call BindingRepository.activate()
.
Modifier and Type | Method and Description |
---|---|
Iterator<Map.Entry<UriPattern,T>> |
iterator() |
BindingMatch<T> |
match(URI uri)
Resolves the binding that best matches (see commentary on
BindingRepository.bind(String, Object) ) the
given URI , and returns a BindingMatch object that describes the match and contains the
matched target. |
T |
resolve(URI uri)
Resolves the binding that best matches (see commentary on
BindingRepository.bind(String, Object) ) the
given URI , and returns that target. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final String DEFAULT
public BindingMatch<T> match(URI uri)
Resolves the binding that best matches (see commentary on BindingRepository.bind(String, Object)
) the
given URI
, and returns a BindingMatch
object that describes the match and contains the
matched target. If there is no binding that matches the given URI, this method returns null.
uri
- The URI to match against the bindings in this set.BindingMatch
object describing the match found, or null if not found.public T resolve(URI uri)
Resolves the binding that best matches (see commentary on BindingRepository.bind(String, Object)
) the
given URI
, and returns that target. If there is no binding that matches the given URI, this method
returns null.
Apart from a null-guard, this is equal to return match(uri).target()
.
uri
- The URI to match against the bindings in this set.match(URI)
public Iterator<Map.Entry<UriPattern,T>> iterator()
iterator
in interface Iterable<Map.Entry<UriPattern,T>>
Copyright © 2018. All rights reserved.