Class EnumMemberHandle
java.lang.Object
com.cryptomorin.xseries.reflection.jvm.MemberHandle
com.cryptomorin.xseries.reflection.jvm.NamedMemberHandle
com.cryptomorin.xseries.reflection.jvm.EnumMemberHandle
- All Implemented Interfaces:
NameableReflectiveHandle, NamedReflectiveHandle, ReflectiveHandle<MethodHandle>
A handle for using reflection for enums, which are technically a
Field.-
Field Summary
Fields inherited from class NamedMemberHandle
namesFields inherited from class MemberHandle
accessFlags, clazz -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Why would you even want to use this method for enums?@Nullable ObjectThis method should only be used once and cached.@NotNull ReflectiveHandle<ReflectedObject> jvm()UsegetEnumConstant()instead.map(MinecraftMapping mapping, String name) reflect()UsegetEnumConstant()instead.It's preferred to use one of theMethodHandlemethods instead.@Nullable MethodHandleUsegetEnumConstant()instead.Why would you even want to use this method for enums?@NotNull MethodHandleUsegetEnumConstant()instead.Methods inherited from class NamedMemberHandle
getPossibleNamesMethods inherited from class MemberHandle
getAccessFlags, getClassHandle, handleAccessible, makeAccessibleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReflectiveHandle
cached, catchError, exists, unwrap
-
Constructor Details
-
EnumMemberHandle
-
-
Method Details
-
map
public EnumMemberHandle map(MinecraftMapping mapping, @Pattern("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*") String name) - Specified by:
mapin interfaceNameableReflectiveHandle- Overrides:
mapin classNamedMemberHandle
-
named
public EnumMemberHandle named(@Pattern("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*") String... names) - Specified by:
namedin interfaceNameableReflectiveHandle- Overrides:
namedin classNamedMemberHandle
-
signature
Why would you even want to use this method for enums?- Specified by:
signaturein classMemberHandle
-
unreflect
UsegetEnumConstant()instead.- See Also:
-
reflectOrNull
UsegetEnumConstant()instead.- See Also:
-
jvm
UsegetEnumConstant()instead.- See Also:
-
reflect
UsegetEnumConstant()instead. If you want to use this, you can do so with:Object enumConstant = handle.reflect().invoke();- Specified by:
reflectin interfaceReflectiveHandle<MethodHandle>- Specified by:
reflectin classMemberHandle- Returns:
- the final JVM object that exists in this runtime.
- Throws:
ReflectiveOperationException- if any errors occur while getting the object, including unknown objects, security issues, etc...- See Also:
-
getEnumConstant
This method should only be used once and cached. -
reflectJvm
Description copied from class:MemberHandleIt's preferred to use one of theMethodHandlemethods instead. This method should only be used for special cases when a direct JVM object is needed.- Specified by:
reflectJvmin classMemberHandle- Throws:
ReflectiveOperationException- See Also:
-
copy
Why would you even want to use this method for enums?- Specified by:
copyin interfaceReflectiveHandle<MethodHandle>- Specified by:
copyin classNamedMemberHandle
-