public class SchemeMappingRegistry extends Object implements ResourceMappingRegistry
SchemeMappingRegistry
provides a mechanism to manage a collection
of ResourceMapping
s, together with the ability to search the registry for
said ResourceMapping
s, possibly using wildcards.
SchemeMappingRegistry
s are Iterable
, the order of iteration
being that in which the ResourceMapping
s where added to the said
SchemeMappingRegistry
.
There is a separate namespace for CacheMapping
and TopicMapping
, allowing
for a cache and a topic with exactly same name.
Modifier and Type | Class and Description |
---|---|
static class |
SchemeMappingRegistry.SchemeMappingKey
Key class for a scheme mapping.
|
Constructor and Description |
---|
SchemeMappingRegistry()
Construct a
SchemeMappingRegistry . |
Modifier and Type | Method and Description |
---|---|
<M extends ResourceMapping> |
findMapping(String sName,
Class<M> type)
Attempts to find the
ResourceMapping that matches the specified
name and type. |
Iterator<ResourceMapping> |
iterator() |
void |
register(ResourceMapping mapping)
Registers a
ResourceMapping with the ResourceMappingRegistry . |
int |
size()
Determines the number of
ResourceMapping s in this ResourceMappingRegistry . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findCacheMapping
forEach, spliterator
public SchemeMappingRegistry()
SchemeMappingRegistry
.public Iterator<ResourceMapping> iterator()
iterator
in interface Iterable<ResourceMapping>
public void register(ResourceMapping mapping) throws IllegalArgumentException
ResourceMappingRegistry
ResourceMapping
with the ResourceMappingRegistry
.register
in interface ResourceMappingRegistry
mapping
- the ResourceMapping
to registerIllegalArgumentException
- if a ResourceMapping
with the same
pattern has already been registeredpublic <M extends ResourceMapping> M findMapping(String sName, Class<M> type)
ResourceMappingRegistry
ResourceMapping
that matches the specified
name and type.
The matching algorithm first attempts to find an exact match of a
ResourceMapping
with the provided name. Should that fail,
all of the currently registered wild-carded ResourceMapping
s are
searched to find a match (in the order in which they were registered),
with the most specific (longest match) being returned if there are
multiple matches.
findMapping
in interface ResourceMappingRegistry
sName
- the nametype
- the type of the mapping to locatenull
if a mapping could not be located
for the specified name and typepublic int size()
ResourceMappingRegistry
ResourceMapping
s in this ResourceMappingRegistry
.size
in interface ResourceMappingRegistry
ResourceMapping
s