E - the type of enum instances this class will manage.
Example usage:
EnumCache<Ecn> ecnEnumCache = EnumCache.of(Ecn.class);
Ecn rfx = ecnEnumCache.get("RFX");
public class StaticEnumClass<E extends Enum<E>> extends EnumCache<E>
EnumCache.
This class is designed to work with traditional Java enum types, enabling efficient
access and operations on the enum instances.
Unlike its counterpart DynamicEnumClass, this class does not support dynamic
creation of enum instances. The enum instances are fixed at compile time as per
standard Java enum behavior.
| Modifier and Type | Method and Description |
|---|---|
E[] |
asArray()
Returns an array containing the enum instances managed by this class in
the order they were declared in the original enum class.
|
<T> Map<E,T> |
createMap()
Creates a map with enum instances as keys.
|
Set<E> |
createSet()
Creates a set for holding enum instances.
|
E |
forIndex(int index)
Retrieves the enum instance at the given ordinal index.
|
int |
size()
Returns the total number of enum instances managed by this class, which corresponds
to the count of enum constants in the original enum class.
|
E |
valueOf(String name)
Returns the enum instance with the specified name.
|
public E valueOf(String name)
null
if the name is null or empty, or if the instance does not exist.public int size()
public E forIndex(int index)
public E[] asArray()
Copyright © 2024. All rights reserved.