@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingLookup extends ClassInjector.AbstractBase
A class injector that uses a java.lang.invoke.MethodHandles$Lookup
object for defining a class.
Important: This functionality is only available starting from Java 9.
Modifier and Type | Class and Description |
---|---|
protected static interface |
ClassInjector.UsingLookup.Dispatcher
A dispatcher for interacting with a method handle lookup.
|
ClassInjector.AbstractBase, ClassInjector.UsingInstrumentation, ClassInjector.UsingLookup, ClassInjector.UsingReflection, ClassInjector.UsingUnsafe
ALLOW_EXISTING_TYPES, SUPPRESS_ACCESS_CHECKS
Modifier | Constructor and Description |
---|---|
protected |
UsingLookup(Object lookup)
Creates a new class injector using a lookup instance.
|
Modifier and Type | Method and Description |
---|---|
ClassInjector.UsingLookup |
in(Class<?> type)
Resolves this injector to use the supplied type's scope.
|
Map<String,Class<?>> |
injectRaw(Map<? extends String,byte[]> types)
Injects the given types into the represented class loader using a mapping from name to binary representation.
|
boolean |
isAlive()
Indicates if this class injector is available on the current VM.
|
static boolean |
isAvailable()
Checks if the current VM is capable of defining classes using a method handle lookup.
|
Class<?> |
lookupType()
Returns the lookup type this injector is based upon.
|
static ClassInjector.UsingLookup |
of(Object lookup)
Creates class injector that defines a class using a method handle lookup.
|
inject
protected UsingLookup(Object lookup)
lookup
- The java.lang.invoke.MethodHandles$Lookup
instance to use.public static ClassInjector.UsingLookup of(Object lookup)
lookup
- The java.lang.invoke.MethodHandles$Lookup
instance to use.public Class<?> lookupType()
public ClassInjector.UsingLookup in(Class<?> type)
type
- The type to resolve the access scope for.public boolean isAlive()
true
if this injector is available on the current VM.public Map<String,Class<?>> injectRaw(Map<? extends String,byte[]> types)
types
- The types to load via injection.public static boolean isAvailable()
true
if the current VM is capable of defining classes using a lookup.Copyright © 2014–2018. All rights reserved.