T - the enum typepublic class EnumBetterReflectionClass<T extends Enum<?>> extends BetterReflectionClass<T>
| Modifier and Type | Field and Description |
|---|---|
protected T[] |
enumConstants |
betterReflectionSuperClass, canonicalName, clasz, constructors, declaredConstructors, declaredFields, declaredMethods, fields, isEnum, jar, jarFile, methods, name, packageName, protectionDomain, runningFromJar, simpleName, superClass, typeName| Constructor and Description |
|---|
EnumBetterReflectionClass(BetterReflectionClass<T> clasz)
Creates a new EnumBetterReflectionClass instance with the given BetterReflectionClass.
|
EnumBetterReflectionClass(Class<T> clasz)
Creates a new EnumBetterReflectionClass instance with the given class.
|
EnumBetterReflectionClass(String className)
Creates a new EnumBetterReflectionClass instance with the given class name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(String value)
Checks if the given value exists in the enum constants of the containing class.
|
T[] |
getEnumConstants() |
Optional<T> |
getIfPresent(String value)
Retrieves the enum constant associated with the specified value,
or an empty Optional if the value is null, empty, or does not exist in the enum constants of the containing class.
|
T |
getOrDefault(String value,
T defaultValue)
Retrieves the enum constant associated with the specified value, or returns the default value if the value is null, empty, or does not exist in the enum constants of the containing
class.
|
T |
getOrNull(String value)
Retrieves the enum constant associated with the specified value,
or returns null if the value is null, empty, or does not exist in the enum constants
of the containing class.
|
String |
toString()
Returns a string representation of the enum constants joined by the default separator ", ".
|
String |
toString(String separator)
Returns a string representation of the enum constants joined by the specified separator.
|
allocateUnsafeInstance, asSubclass, cast, dumpMethodHeaders, dumpMethodHeaders, dumpMethodHeaders, dumpMethodHeaders, forName, forNameAsArray, getArray, getArrayClass, getArrayClassIf, getBetterReflectionArrayClass, getBetterReflectionSuperClass, getCanonicalName, getClasz, getConstructor, getConstructor, getConstructors, getDeclaredConstructor, getDeclaredConstructor, getDeclaredConstructors, getDeclaredField, getDeclaredFields, getDeclaredFieldValue, getDeclaredMethod, getDeclaredMethod, getDeclaredMethods, getField, getFields, getJar, getJarFile, getMethod, getMethod, getMethods, getName, getPackageName, getProtectionDomain, getSimpleName, getSuperclass, getTypeName, invokeDeclaredMethod, invokeMethod, invokeMethods, isAssignableFrom, isAssignableFrom, isEnum, isEnumWrapped, isInstance, isRunningFromJar, newInstancepublic EnumBetterReflectionClass(String className) throws ClassNotFoundException
className - the name of the class to wrapClassNotFoundException - if the class cannot be foundIllegalStateException - if the class is not an enum classRuntimeException - if an exception occurs during reflectionpublic EnumBetterReflectionClass(BetterReflectionClass<T> clasz)
clasz - the class to wrappublic T[] getEnumConstants()
public boolean contains(String value)
value - the value to check if it existspublic Optional<T> getIfPresent(String value)
value - the value to retrieve the enum constant forpublic T getOrNull(String value)
value - the value to retrieve the enum constant forpublic T getOrDefault(String value, T defaultValue)
value - the value to retrieve the enum constant fordefaultValue - the default value to return if the specified value does not existpublic String toString(String separator)
separator - the separator to use between each enum constantCopyright © 2024. All rights reserved.