@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.MethodHandles
A dispatcher for
java.lang.invoke.MethodHandles . |
ClassInjector.AbstractBase, ClassInjector.UsingInstrumentation, ClassInjector.UsingJna, 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(Set<String> names,
ClassFileLocator classFileLocator)
Injects the given types into the represented class loader.
|
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, inject, injectRaw
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(Set<String> names, ClassFileLocator classFileLocator)
names
- The names of the types to load via injection.classFileLocator
- The class file locator to use for resolving binary representations.public static boolean isAvailable()
true
if the current VM is capable of defining classes using a lookup.Copyright © 2014–2025. All rights reserved.