Interface NamedLookup<T extends Named>

  • Type Parameters:
    T - the named type

    public interface NamedLookup<T extends Named>
    A lookup for named instances.

    This interface is used to lookup objects that can be identified by a unique name.

    • Method Detail

      • lookup

        default T lookup​(String name)
        Looks up an instance by name, returning null if not found.

        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().

        Parameters:
        name - the name to lookup
        Returns:
        the named object, null if not found
      • lookupAll

        Map<String,​T> lookupAll()
        Returns the immutable map of known instances by name.

        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.

        Returns:
        the immutable map of enum instance by name