java.lang.Object
com.pervasive.datarush.analytics.util.DynamicEnum
- All Implemented Interfaces:
Serializable,Iterable<DynamicEnum.Value>
Provides enum-like semantics ( ordinal mapping ) for dynamically constructed data.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing new dynamic enumsstatic final classA value of a given enumeration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the Value that corresponds to the given name.forOrdinal(int ordinal) Returns the Value that corresponds to the given ordinal.inthashCode()iterator()Iterates over all the Values in the enumeration.names()Returns the set of names.Returns the list of names.intsize()Returns the number of values in the enumeration.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DynamicEnum
Creates a new DynamicEnum. Note that it is the responsibility of the consumer to construct instances of DynamicEnum in such a way that there will not be two instances of the "same" DynamicEnum present in the same hashmap at the same time.- Parameters:
values- the values of this enum
-
-
Method Details
-
forOrdinal
Returns the Value that corresponds to the given ordinal.- Parameters:
ordinal- The ordinal.- Returns:
- the Value that corresponds to the given ordinal.
- Throws:
ArrayIndexOutOfBoundsException- If ordinal is not a valid ordinal.
-
forName
Returns the Value that corresponds to the given name.- Parameters:
name- The name.- Returns:
- the value or null if name is not a valid name or name is null
-
iterator
Iterates over all the Values in the enumeration. Values will be returned in the order that they were added.- Specified by:
iteratorin interfaceIterable<DynamicEnum.Value>
-
names
Returns the set of names. The returned set will be ordered by ordinal.- Returns:
- the set of names.
-
namesList
Returns the list of names. The returned list will be ordered by ordinal.- Returns:
- the list of names.
-
size
public int size()Returns the number of values in the enumeration.- Returns:
- the number of values in the enumeration.
-
hashCode
public int hashCode() -
equals
-