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 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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForJava9CapableVm(Method privateLookupIn, Method lookupClass, Method lookupModes, 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 Class<?>
defineClass(Object lookup, byte[] binaryRepresentation)
Defines a class.boolean
isAlive()
Indicates if this dispatcher is available on the current VM.int
lookupModes(Object lookup)
Returns a lookup objects lookup types.Class<?>
lookupType(Object lookup)
Returns the lookup type for a given method handle lookup.Object
resolve(Object lookup, Class<?> type)
Resolves the supplied lookup instance's access scope for the supplied type.
-
-
-
Constructor Detail
-
ForJava9CapableVm
protected ForJava9CapableVm(Method privateLookupIn, Method lookupClass, Method lookupModes, Method defineClass)
Creates a new dispatcher for a Java 9 capable VM.- Parameters:
privateLookupIn
- Thejava.lang.invoke.MethodHandles$#privateLookupIn
method.lookupClass
- Thejava.lang.invoke.MethodHandles$Lookup#lookupClass
method.lookupModes
- Thejava.lang.invoke.MethodHandles$Lookup#lookupModes
method.defineClass
- Thejava.lang.invoke.MethodHandles$Lookup#defineClass
method.
-
-
Method Detail
-
isAlive
public boolean isAlive()
Indicates if this dispatcher is available on the current VM.- Specified by:
isAlive
in interfaceClassInjector.UsingLookup.Dispatcher
- Returns:
true
if this dispatcher is alive.
-
lookupType
public Class<?> lookupType(Object lookup)
Returns the lookup type for a given method handle lookup.- Specified by:
lookupType
in interfaceClassInjector.UsingLookup.Dispatcher
- Parameters:
lookup
- The lookup instance.- Returns:
- The lookup type.
-
lookupModes
public int lookupModes(Object lookup)
Returns a lookup objects lookup types.- Specified by:
lookupModes
in interfaceClassInjector.UsingLookup.Dispatcher
- Parameters:
lookup
- The lookup instance.- Returns:
- The modifiers indicating the instance's lookup modes.
-
resolve
public Object resolve(Object lookup, Class<?> type)
Resolves the supplied lookup instance's access scope for the supplied type.- Specified by:
resolve
in interfaceClassInjector.UsingLookup.Dispatcher
- Parameters:
lookup
- The lookup to use.type
- The type to resolve the scope for.- Returns:
- An appropriate lookup instance.
-
defineClass
public Class<?> defineClass(Object lookup, byte[] binaryRepresentation)
Defines a class.- Specified by:
defineClass
in interfaceClassInjector.UsingLookup.Dispatcher
- Parameters:
lookup
- Thejava.lang.invoke.MethodHandles$Lookup
instance to use.binaryRepresentation
- The defined class's binary representation.- Returns:
- The defined class.
-
-