T
- The type of registered objects.@Contract(threading=SAFE) public class UriRegexMatcher<T> extends Object implements LookupRegistry<T>
The insertion order is in maintained in that map such that the lookup tests each regex until there is a match. This class can be used to resolve an object matching a particular request URI.
Constructor and Description |
---|
UriRegexMatcher() |
Modifier and Type | Method and Description |
---|---|
T |
lookup(String path)
Looks up an object matching the given request path.
|
void |
register(String regex,
T obj)
Registers the given object for URIs matching the given regex.
|
String |
toString() |
void |
unregister(String regex)
Removes registered object, if exists, for the given regex.
|
public void register(String regex, T obj)
register
in interface LookupRegistry<T>
regex
- the regex to register the handler for.obj
- the object.public void unregister(String regex)
unregister
in interface LookupRegistry<T>
regex
- the regex to unregister.public T lookup(String path)
lookup
in interface LookupRegistry<T>
path
- the request pathnull
if no match is found.Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.