T
- the named typepublic interface NamedLookup<T extends Named>
This interface is used to lookup objects that can be identified by a unique name.
Modifier and Type | Method and Description |
---|---|
default T |
lookup(String name)
Looks up an instance by name, returning null if not found.
|
Map<String,T> |
lookupAll()
Returns the immutable map of known instances by name.
|
default T lookup(String name)
The name contains enough information to be able to recreate the instance.
The lookup should return null if the name is not known.
The lookup must match the name where the match is case sensitive.
Where possible implementations should match the upper-case form of the name, using Locale.ENGLISH
.
Implementations can match completely case insensitive if desired, however this is not required.
An exception should only be thrown if an error occurs during lookup.
The default implementation uses lookupAll()
.
name
- the name to lookupMap<String,T> lookupAll()
This method returns all known instances.
It is permitted for an implementation to return an empty map, however this will
reduce the usefulness of the matching method on ExtendedEnum
.
The map may include instances keyed under an alternate name.
For example, the map will often contain the same entry keyed under the upper-cased form of the name.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.