Package net.bytebuddy.utility
Class JavaConstant.MethodHandle.Dispatcher.AbstractBase
- java.lang.Object
-
- net.bytebuddy.utility.JavaConstant.MethodHandle.Dispatcher.AbstractBase
-
- All Implemented Interfaces:
JavaConstant.MethodHandle.Dispatcher,JavaConstant.MethodHandle.Dispatcher.Initializable
- Direct Known Subclasses:
JavaConstant.MethodHandle.Dispatcher.ForJava7CapableVm,JavaConstant.MethodHandle.Dispatcher.ForJava8CapableVm
- Enclosing interface:
- JavaConstant.MethodHandle.Dispatcher
@Enhance public abstract static class JavaConstant.MethodHandle.Dispatcher.AbstractBase extends java.lang.Object implements JavaConstant.MethodHandle.Dispatcher, JavaConstant.MethodHandle.Dispatcher.Initializable
An abstract base implementation of a dispatcher.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.utility.JavaConstant.MethodHandle.Dispatcher
JavaConstant.MethodHandle.Dispatcher.AbstractBase, JavaConstant.MethodHandle.Dispatcher.CreationAction, JavaConstant.MethodHandle.Dispatcher.ForJava7CapableVm, JavaConstant.MethodHandle.Dispatcher.ForJava8CapableVm, JavaConstant.MethodHandle.Dispatcher.ForLegacyVm, JavaConstant.MethodHandle.Dispatcher.Initializable
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.reflect.MethodgetDeclaringClassA reference tojava.lang.invoke.MethodHandleInfo#getDeclaringClass.protected java.lang.reflect.MethodgetMethodTypeA reference tojava.lang.invoke.MethodHandleInfo#getMethodType.protected java.lang.reflect.MethodgetNameA reference tojava.lang.invoke.MethodHandleInfo#getName.protected java.lang.reflect.MethodgetReferenceKindA reference tojava.lang.invoke.MethodHandleInfo#getReferenceKind.protected java.lang.reflect.MethodlookupClassA reference tojava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.private static java.lang.Object[]NO_ARGUMENTSAn empty array that can be used to indicate no arguments to avoid an allocation on a reflective call.protected java.lang.reflect.MethodparameterArrayA reference tojava.lang.invoke.MethodType#parameterArray.protected java.lang.reflect.MethodpublicLookupA reference tojava.lang.invoke.MethodHandles#publicLookup.protected java.lang.reflect.MethodreturnTypeA reference tojava.lang.invoke.MethodType#returnType.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBase(java.lang.reflect.Method publicLookup, java.lang.reflect.Method getName, java.lang.reflect.Method getDeclaringClass, java.lang.reflect.Method getReferenceKind, java.lang.reflect.Method getMethodType, java.lang.reflect.Method returnType, java.lang.reflect.Method parameterArray, java.lang.reflect.Method lookupClass)Creates a legal dispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>getDeclaringClass(java.lang.Object methodHandleInfo)Returns the declaring class of the supplied method handle info.java.lang.ObjectgetMethodType(java.lang.Object methodHandleInfo)Returns a method handle info's method type.java.lang.StringgetName(java.lang.Object methodHandleInfo)Returns the method name of the supplied method handle info.intgetReferenceKind(java.lang.Object methodHandleInfo)Returns the reference kind of the supplied method handle info.java.lang.Class<?>lookupType(java.lang.Object lookup)Returns the lookup type of a givenjava.lang.invoke.MethodHandles$Lookupinstance.java.util.List<? extends java.lang.Class<?>>parameterArray(java.lang.Object methodType)Returns the parameter types of the supplied method type.java.lang.ObjectpublicLookup()Returns a publicjava.lang.invoke.MethodHandles.Lookupinstance.java.lang.Class<?>returnType(java.lang.Object methodType)Returns the return type of the supplied method type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.utility.JavaConstant.MethodHandle.Dispatcher
reveal
-
Methods inherited from interface net.bytebuddy.utility.JavaConstant.MethodHandle.Dispatcher.Initializable
initialize
-
-
-
-
Field Detail
-
NO_ARGUMENTS
private static final java.lang.Object[] NO_ARGUMENTS
An empty array that can be used to indicate no arguments to avoid an allocation on a reflective call.
-
publicLookup
protected final java.lang.reflect.Method publicLookup
A reference tojava.lang.invoke.MethodHandles#publicLookup.
-
getName
protected final java.lang.reflect.Method getName
A reference tojava.lang.invoke.MethodHandleInfo#getName.
-
getDeclaringClass
protected final java.lang.reflect.Method getDeclaringClass
A reference tojava.lang.invoke.MethodHandleInfo#getDeclaringClass.
-
getReferenceKind
protected final java.lang.reflect.Method getReferenceKind
A reference tojava.lang.invoke.MethodHandleInfo#getReferenceKind.
-
getMethodType
protected final java.lang.reflect.Method getMethodType
A reference tojava.lang.invoke.MethodHandleInfo#getMethodType.
-
returnType
protected final java.lang.reflect.Method returnType
A reference tojava.lang.invoke.MethodType#returnType.
-
parameterArray
protected final java.lang.reflect.Method parameterArray
A reference tojava.lang.invoke.MethodType#parameterArray.
-
lookupClass
protected final java.lang.reflect.Method lookupClass
A reference tojava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.
-
-
Constructor Detail
-
AbstractBase
protected AbstractBase(java.lang.reflect.Method publicLookup, java.lang.reflect.Method getName, java.lang.reflect.Method getDeclaringClass, java.lang.reflect.Method getReferenceKind, java.lang.reflect.Method getMethodType, java.lang.reflect.Method returnType, java.lang.reflect.Method parameterArray, java.lang.reflect.Method lookupClass)Creates a legal dispatcher.- Parameters:
publicLookup- A reference tojava.lang.invoke.MethodHandles#publicLookup.getName- A reference tojava.lang.invoke.MethodHandleInfo#getName.getDeclaringClass- A reference tojava.lang.invoke.MethodHandleInfo#getDeclaringClass.getReferenceKind- A reference tojava.lang.invoke.MethodHandleInfo#getReferenceKind.getMethodType- A reference tojava.lang.invoke.MethodHandleInfo#getMethodType.returnType- A reference tojava.lang.invoke.MethodType#returnType.parameterArray- A reference tojava.lang.invoke.MethodType#parameterArray.lookupClass- A reference tojava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.
-
-
Method Detail
-
publicLookup
public java.lang.Object publicLookup()
Returns a publicjava.lang.invoke.MethodHandles.Lookupinstance.- Specified by:
publicLookupin interfaceJavaConstant.MethodHandle.Dispatcher.Initializable- Returns:
- A public
java.lang.invoke.MethodHandles.Lookupinstance.
-
getMethodType
public java.lang.Object getMethodType(java.lang.Object methodHandleInfo)
Returns a method handle info's method type.- Specified by:
getMethodTypein interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodHandleInfo- The method handle info to introspect.- Returns:
- The
java.lang.invoke.MethodTypeinstance representing the method handle's type.
-
getReferenceKind
public int getReferenceKind(java.lang.Object methodHandleInfo)
Returns the reference kind of the supplied method handle info.- Specified by:
getReferenceKindin interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodHandleInfo- The method handle to be introspected.- Returns:
- The method handle info's reference type.
-
getDeclaringClass
public java.lang.Class<?> getDeclaringClass(java.lang.Object methodHandleInfo)
Returns the declaring class of the supplied method handle info.- Specified by:
getDeclaringClassin interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodHandleInfo- The method handle to be introspected.- Returns:
- The method handle info's declaring class.
-
getName
public java.lang.String getName(java.lang.Object methodHandleInfo)
Returns the method name of the supplied method handle info.- Specified by:
getNamein interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodHandleInfo- The method handle to be introspected.- Returns:
- The method handle info's method name.
-
returnType
public java.lang.Class<?> returnType(java.lang.Object methodType)
Returns the return type of the supplied method type.- Specified by:
returnTypein interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodType- The method type to be introspected.- Returns:
- The method type's return type.
-
parameterArray
public java.util.List<? extends java.lang.Class<?>> parameterArray(java.lang.Object methodType)
Returns the parameter types of the supplied method type.- Specified by:
parameterArrayin interfaceJavaConstant.MethodHandle.Dispatcher- Parameters:
methodType- The method type to be introspected.- Returns:
- The method type's parameter types.
-
lookupType
public java.lang.Class<?> lookupType(java.lang.Object lookup)
Returns the lookup type of a givenjava.lang.invoke.MethodHandles$Lookupinstance.- Specified by:
lookupTypein interfaceJavaConstant.MethodHandle.Dispatcher.Initializable- Parameters:
lookup- Ajava.lang.invoke.MethodHandles$Lookupinstance.- Returns:
- The provided instance's lookup type.
-
-