Package net.bytebuddy.dynamic.loading
Class ClassInjector.UsingLookup.Dispatcher.ForJava9CapableVm
- java.lang.Object
-
- net.bytebuddy.dynamic.loading.ClassInjector.UsingLookup.Dispatcher.ForJava9CapableVm
-
- All Implemented Interfaces:
ClassInjector.UsingLookup.Dispatcher
- Enclosing interface:
- ClassInjector.UsingLookup.Dispatcher
@Enhance public static class ClassInjector.UsingLookup.Dispatcher.ForJava9CapableVm extends java.lang.Object implements ClassInjector.UsingLookup.Dispatcher
A dispatcher for a Java 9 capable VM that supports class definition via method handles.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.ClassInjector.UsingLookup.Dispatcher
ClassInjector.UsingLookup.Dispatcher.Creator, ClassInjector.UsingLookup.Dispatcher.ForJava9CapableVm, ClassInjector.UsingLookup.Dispatcher.ForLegacyVm
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.MethoddefineClassThejava.lang.invoke.MethodHandles$Lookup#defineClassmethod.private java.lang.reflect.MethodlookupClassThejava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.private java.lang.reflect.MethodlookupModesThejava.lang.invoke.MethodHandles$Lookup#lookupModesmethod.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.private java.lang.reflect.MethodprivateLookupInThejava.lang.invoke.MethodHandles$#privateLookupInmethod.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForJava9CapableVm(java.lang.reflect.Method privateLookupIn, java.lang.reflect.Method lookupClass, java.lang.reflect.Method lookupModes, java.lang.reflect.Method defineClass)Creates a new dispatcher for a Java 9 capable VM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>defineClass(java.lang.Object lookup, byte[] binaryRepresentation)Defines a class.booleanisAlive()Indicates if this dispatcher is available on the current VM.intlookupModes(java.lang.Object lookup)Returns a lookup objects lookup types.java.lang.Class<?>lookupType(java.lang.Object lookup)Returns the lookup type for a given method handle lookup.java.lang.Objectresolve(java.lang.Object lookup, java.lang.Class<?> type)Resolves the supplied lookup instance's access scope for the supplied type.
-
-
-
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.
-
privateLookupIn
private final java.lang.reflect.Method privateLookupIn
Thejava.lang.invoke.MethodHandles$#privateLookupInmethod.
-
lookupClass
private final java.lang.reflect.Method lookupClass
Thejava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.
-
lookupModes
private final java.lang.reflect.Method lookupModes
Thejava.lang.invoke.MethodHandles$Lookup#lookupModesmethod.
-
defineClass
private final java.lang.reflect.Method defineClass
Thejava.lang.invoke.MethodHandles$Lookup#defineClassmethod.
-
-
Constructor Detail
-
ForJava9CapableVm
protected ForJava9CapableVm(java.lang.reflect.Method privateLookupIn, java.lang.reflect.Method lookupClass, java.lang.reflect.Method lookupModes, java.lang.reflect.Method defineClass)Creates a new dispatcher for a Java 9 capable VM.- Parameters:
privateLookupIn- Thejava.lang.invoke.MethodHandles$#privateLookupInmethod.lookupClass- Thejava.lang.invoke.MethodHandles$Lookup#lookupClassmethod.lookupModes- Thejava.lang.invoke.MethodHandles$Lookup#lookupModesmethod.defineClass- Thejava.lang.invoke.MethodHandles$Lookup#defineClassmethod.
-
-
Method Detail
-
isAlive
public boolean isAlive()
Indicates if this dispatcher is available on the current VM.- Specified by:
isAlivein interfaceClassInjector.UsingLookup.Dispatcher- Returns:
trueif this dispatcher is alive.
-
lookupType
public java.lang.Class<?> lookupType(java.lang.Object lookup)
Returns the lookup type for a given method handle lookup.- Specified by:
lookupTypein interfaceClassInjector.UsingLookup.Dispatcher- Parameters:
lookup- The lookup instance.- Returns:
- The lookup type.
-
lookupModes
public int lookupModes(java.lang.Object lookup)
Returns a lookup objects lookup types.- Specified by:
lookupModesin interfaceClassInjector.UsingLookup.Dispatcher- Parameters:
lookup- The lookup instance.- Returns:
- The modifiers indicating the instance's lookup modes.
-
resolve
public java.lang.Object resolve(java.lang.Object lookup, java.lang.Class<?> type)Resolves the supplied lookup instance's access scope for the supplied type.- Specified by:
resolvein interfaceClassInjector.UsingLookup.Dispatcher- Parameters:
lookup- The lookup to use.type- The type to resolve the scope for.- Returns:
- An appropriate lookup instance.
-
defineClass
public java.lang.Class<?> defineClass(java.lang.Object lookup, byte[] binaryRepresentation)Defines a class.- Specified by:
defineClassin interfaceClassInjector.UsingLookup.Dispatcher- Parameters:
lookup- Thejava.lang.invoke.MethodHandles$Lookupinstance to use.binaryRepresentation- The defined class's binary representation.- Returns:
- The defined class.
-
-