Class MethodMemberHandle
java.lang.Object
com.cryptomorin.xseries.reflection.jvm.MemberHandle
com.cryptomorin.xseries.reflection.jvm.NamedMemberHandle
com.cryptomorin.xseries.reflection.jvm.FlaggedNamedMemberHandle
com.cryptomorin.xseries.reflection.jvm.MethodMemberHandle
- All Implemented Interfaces:
NameableReflectiveHandle,NamedReflectiveHandle,ReflectiveHandle<MethodHandle>
A handle for using reflection for
Method.-
Field Summary
FieldsFields inherited from class com.cryptomorin.xseries.reflection.jvm.FlaggedNamedMemberHandle
returnTypeFields inherited from class com.cryptomorin.xseries.reflection.jvm.NamedMemberHandle
namesFields inherited from class com.cryptomorin.xseries.reflection.jvm.MemberHandle
accessFlags, clazz -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasStatic()copy()Creates a new handle with the same properties.@NotNull ReflectiveHandle<ReflectedObject> jvm()UsuallyReflectiveHandles returnMethodHandlewhen possible, however this method returns the raw object using the traditional Java reflection API which can be:FieldMethodConstructorClass (same as its normal ReflectiveHandle)map(MinecraftMapping mapping, String name) parameters(ClassHandle... parameterTypes) Overrides any previously set parameters.parameters(Class<?>... parameterTypes) reflect()The heart of the class.It's preferred to use one of theMethodHandlemethods instead.returns(ClassHandle clazz) Changes the signature of this handle according to the given java code (seeReflectionParser) This overrides the current declaration, but names will be kept and any new names specified in the signature will also be added.UsesLambdaMetafactoryto create runtime-generated ASM classes.toString()Methods inherited from class com.cryptomorin.xseries.reflection.jvm.FlaggedNamedMemberHandle
getParameters, getReturnTypeMethods inherited from class com.cryptomorin.xseries.reflection.jvm.NamedMemberHandle
getPossibleNamesMethods inherited from class com.cryptomorin.xseries.reflection.jvm.MemberHandle
getAccessFlags, getClassHandle, handleAccessible, makeAccessibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.cryptomorin.xseries.reflection.ReflectiveHandle
cached, catchError, exists, reflectOrNull, unreflect, unwrap
-
Field Details
-
parameterTypes
-
-
Constructor Details
-
MethodMemberHandle
-
-
Method Details
-
parameters
Overrides any previously set parameters. -
returns
- Overrides:
returnsin classFlaggedNamedMemberHandle
-
returns
- Overrides:
returnsin classFlaggedNamedMemberHandle
-
asStatic
- Overrides:
asStaticin classFlaggedNamedMemberHandle
-
parameters
-
signature
Description copied from class:MemberHandleChanges the signature of this handle according to the given java code (seeReflectionParser) This overrides the current declaration, but names will be kept and any new names specified in the signature will also be added.- Specified by:
signaturein classMemberHandle
-
map
public MethodMemberHandle map(MinecraftMapping mapping, @Pattern("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*") String name) - Specified by:
mapin interfaceNameableReflectiveHandle- Overrides:
mapin classNamedMemberHandle
-
named
public MethodMemberHandle named(@Pattern("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*") String... names) - Specified by:
namedin interfaceNameableReflectiveHandle- Overrides:
namedin classNamedMemberHandle
-
getMethodType
- Since:
- 14.0.0
-
toLambda
@Experimental public CallSite toLambda(Class<?> proxy, String interfaceMethod) throws ReflectiveOperationException, LambdaConversionException UsesLambdaMetafactoryto create runtime-generated ASM classes.- Parameters:
proxy- the interface used to implement this method.interfaceMethod- the name of the method insideproxyinterface to implement.- Returns:
- A callable object with no instance attached.
- Throws:
ReflectiveOperationException- ifreflect()fails.LambdaConversionException- readLambdaMetafactory.metafactory(MethodHandles.Lookup, String, MethodType, MethodType, MethodHandle, MethodType)for more info.- Since:
- 14.0.0
-
reflect
Description copied from interface:ReflectiveHandleThe heart of the class.- 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:
-
jvm
Description copied from interface:ReflectiveHandleUsuallyReflectiveHandles returnMethodHandlewhen possible, however this method returns the raw object using the traditional Java reflection API which can be:- See Also:
-
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
Description copied from interface:ReflectiveHandleCreates a new handle with the same properties.- Specified by:
copyin interfaceReflectiveHandle<MethodHandle>- Specified by:
copyin classNamedMemberHandle
-
toString
-