The standard Java Enum is a fixed set of constants defined at compile time.
In many scenarios this can be too limiting and this class provides an alternative.

An INI configuration file is used to define the set of named instances.
For more information on the process of loading the configuration file, see ResourceConfig.

The named instances are loaded via provider classes.
A provider class is either an implementation of NamedLookup or a class
providing public static final enum constants.

The configuration file also supports the notion of alternate names (aliases).
This allows many different names to be used to lookup the same instance.

Three sections control the loading of additional information.

The 'providers' section contains a number of properties, one for each provider.
The key is the full class name of the provider.
The value is 'constants', 'lookup' or 'instance', and is used to obtain a NamedLookup instance.
A 'constants' provider must contain public static constants of the correct type,
which will be reflectively located and wrapped in a NamedLookup.
A 'lookup' provider must implement NamedLookup and have a no-args constructor.
An 'instance' provider must have a static variable named "INSTANCE" of type NamedLookup.

The 'alternates' section contains a number of properties, one for each alternate name.
The key is the alternate name, the value is the standard name.
Alternate names are used when looking up an extended enum.

The 'externals' sections contains a number of properties intended to allow external enum names to be mapped.
Unlike 'alternates', which are always included, 'externals' are only included when requested.
There may be multiple external groups to handle different external providers of data.
For example, the mapping used by FpML may differ from that used by Bloomberg.

Each 'externals' section has a name of the form 'externals.Foo', where 'Foo' is the name of the group.
Each property line in the section is of the same format as the 'alternates' section.
It maps the external name to the standard name.

It is intended that this class is used as a helper class to load the configuration
and manage the map of names to instances. It should be created and used by the author
of the main abstract extended enum class, and not be application developers.

Method Detail

of

Calling this method loads configuration files to determine the extended enum values.
The configuration file has the same simple name as the specified type and is a
INI file with the suffix '.ini'.
See class-level documentation for more information.

lookup

This finds the instance matching the specified name, ensuring it is of the specified type.
Instances may have alternate names (aliases), thus the returned instance
may have a name other than that requested.

lookupAll

This method returns all known instances.
It is permitted for an enum provider implementation to return an empty map,
thus the map may not be complete.
The map may include instances keyed under an alternate name, such as names
in upper case, however it will not include the base set of
alternate names.

externalNameGroups

External names are used to map names used by external systems to the standard name used here.
There can be multiple groups of mappings to external systems,
For example, the mapping used by FpML may differ from that used by Bloomberg.

Returns:

the set of groups that have external names

externalNames

External names are used to map names used by external systems to the standard name used here.
There can be multiple groups of mappings to external systems,
For example, the mapping used by FpML may differ from that used by Bloomberg.

The result provides mapping between the external name and the standard name.