E
- the type of enum instances this class will manage.public class DynamicEnumClass<E extends CoreDynamicEnum<E>> extends EnumCache<E>
EnumCache
.
It allows dynamic creation and management of enum-like instances.Modifier and Type | Method and Description |
---|---|
E[] |
asArray() |
<T> Map<E,T> |
createMap() |
Set<E> |
createSet() |
E |
forIndex(int index)
Retrieves the enum instance at the given index.
|
E |
get(String name)
Returns the enum constant with the specified name.
|
void |
reset()
Resets the internal state of this class.
|
int |
size()
Returns the number of enum instances currently managed by this class.
|
E |
valueOf(String name)
Returns the enum constant with the specified name, creating it if it doesn't exist.
|
public E get(String name)
get
in class EnumCache<E extends CoreDynamicEnum<E>>
name
- the name of the enum constant to be returned.public E valueOf(String name)
valueOf
in class EnumCache<E extends CoreDynamicEnum<E>>
name
- the name of the enum constant to be returned.public int size()
size
in class EnumCache<E extends CoreDynamicEnum<E>>
public E forIndex(int index)
forIndex
in class EnumCache<E extends CoreDynamicEnum<E>>
index
- the index of the enum instance to retrieve.IndexOutOfBoundsException
- if the index is out of range.public <T> Map<E,T> createMap()
createMap
in class EnumCache<E extends CoreDynamicEnum<E>>
public Set<E> createSet()
createSet
in class EnumCache<E extends CoreDynamicEnum<E>>
@TestOnly public void reset()
This method should only be used for testing purposes.
Copyright © 2023. All rights reserved.