com.sun.n1.util.enum
Interface EnumFactory

All Known Subinterfaces:
EnumFactoryX
All Known Implementing Classes:
AppType.Factory, ComparisonType.Factory, ConnectionType.Factory, CriteriaShorthand.Factory, EntityType.Factory, EnumFactoryImpl, EnumFactoryXImpl, ExecutionMode.Factory, HostStatus.Factory, Level.Factory, Modifier.Factory, NamedBlockType.Factory, OutputType.Factory, RunLevel.Factory, Scope.Factory, Style.Factory, TargetStatusCode.Factory, TaskStatus.Factory, TaskType.Factory, TransformType.Factory, UpgradeNodeState.FACTORY, UpgradeTaskState.FACTORY, Visibility.Factory

public interface EnumFactory

An enum factory allows a client to lookup all values defined for a particular Enum subclass, and also lookup a particular value by its int or String value. By convention, each strongly-typed enum subclass declares an EnumFactory constant named "FACTORY" that can be used to lookup the enums defined by that class.


Method Summary
 Enum[] getAllEnums(Enum[] container)
          Returns an array of all enums.
 Enum getEnum(int value)
          Returns the enum associated with the passed int value.
 Enum getEnum(java.lang.String value)
          Returns the enum associated with the passed String value.
 

Method Detail

getEnum

Enum getEnum(java.lang.String value)
             throws NoSuchEnumException
Returns the enum associated with the passed String value. If no such enum exists, and exception is raised.

Parameters:
value - the string value of the desired enum.
Returns:
the enum associated with the passed value.
Throws:
NoSuchEnumException - if no such enum exists.

getEnum

Enum getEnum(int value)
             throws NoSuchEnumException
Returns the enum associated with the passed int value. If no such enum exists, and exception is raised.

Parameters:
value - the int value of the desired enum.
Returns:
the enum associated with the passed value.
Throws:
NoSuchEnumException - if no such enum exists.

getAllEnums

Enum[] getAllEnums(Enum[] container)
Returns an array of all enums. If the passed array is large enough to contain all the enums, it is used. Otherwise, a new array with the same runtime type of the passed array is created and used instead.

Returns:
an array of all enums.