Uses of Class
java.lang.invoke.MethodHandles.Lookup
Package | Description |
---|---|
java.lang |
Provides classes that are fundamental to the design of the Java
programming language.
|
java.lang.constant |
Classes and interfaces to represent nominal descriptors for run-time
entities such as classes or method handles, and classfile entities such as
constant pool entries or
invokedynamic call sites. |
java.lang.invoke |
The
java.lang.invoke package provides low-level primitives for interacting
with the Java Virtual Machine. |
java.lang.runtime |
The
java.lang.runtime package provides low-level runtime support
for the Java language. |
-
Uses of MethodHandles.Lookup in java.lang
Methods in java.lang with parameters of type MethodHandles.Lookup Modifier and Type Method Description Double
Double. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this instance as aConstantDesc
, the result of which is the instance itself.Float
Float. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this instance as aConstantDesc
, the result of which is the instance itself.Integer
Integer. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this instance as aConstantDesc
, the result of which is the instance itself.Long
Long. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this instance as aConstantDesc
, the result of which is the instance itself.String
String. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this instance as aConstantDesc
, the result of which is the instance itself. -
Uses of MethodHandles.Lookup in java.lang.constant
Methods in java.lang.constant with parameters of type MethodHandles.Lookup Modifier and Type Method Description CallSite
DynamicCallSiteDesc. resolveCallSiteDesc(MethodHandles.Lookup lookup)
Reflectively invokes the bootstrap method with the specified arguments, and return the resultingCallSite
Object
ConstantDesc. resolveConstantDesc(MethodHandles.Lookup lookup)
Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. -
Uses of MethodHandles.Lookup in java.lang.invoke
Methods in java.lang.invoke that return MethodHandles.Lookup Modifier and Type Method Description MethodHandles.Lookup
MethodHandles.Lookup. dropLookupMode(int modeToDrop)
Creates a lookup on the same lookup class which this lookup object finds members, but with a lookup mode that has lost the given lookup mode.MethodHandles.Lookup
MethodHandles.Lookup. in(Class<?> requestedLookupClass)
Creates a lookup on the specified new lookup class.static MethodHandles.Lookup
MethodHandles. lookup()
Returns alookup object
with full capabilities to emulate all supported bytecode behaviors of the caller.static MethodHandles.Lookup
MethodHandles. privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller)
Returns alookup
object on a target class to emulate all supported bytecode behaviors, including private access.static MethodHandles.Lookup
MethodHandles. publicLookup()
Returns alookup object
which is trusted minimally.Methods in java.lang.invoke with parameters of type MethodHandles.Lookup Modifier and Type Method Description static CallSite
LambdaMetafactory. altMetafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, Object... args)
Facilitates the creation of simple "function objects" that implement one or more interfaces by delegation to a providedMethodHandle
, after appropriate type adaptation and partial evaluation of arguments.static VarHandle
ConstantBootstraps. arrayVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> arrayClass)
Finds aVarHandle
for an array type.static <E extends Enum<E>>
EConstantBootstraps. enumConstant(MethodHandles.Lookup lookup, String name, Class<E> type)
Returns anenum
constant of the type specified bytype
with the name specified byname
.static VarHandle
ConstantBootstraps. fieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType)
Finds aVarHandle
for an instance field.static Object
ConstantBootstraps. getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type)
Returns the value of a static final field declared in the class which is the same as the field's type (or, for primitive-valued fields, declared in the wrapper class.)static Object
ConstantBootstraps. getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type, Class<?> declaringClass)
Returns the value of a static final field.static Object
ConstantBootstraps. invoke(MethodHandles.Lookup lookup, String name, Class<?> type, MethodHandle handle, Object... args)
Returns the result of invoking a method handle with the provided arguments.static CallSite
StringConcatFactory. makeConcat(MethodHandles.Lookup lookup, String name, MethodType concatType)
Facilitates the creation of optimized String concatenation methods, that can be used to efficiently concatenate a known number of arguments of known types, possibly after type adaptation and partial evaluation of arguments.static CallSite
StringConcatFactory. makeConcatWithConstants(MethodHandles.Lookup lookup, String name, MethodType concatType, String recipe, Object... constants)
Facilitates the creation of optimized String concatenation methods, that can be used to efficiently concatenate a known number of arguments of known types, possibly after type adaptation and partial evaluation of arguments.static CallSite
LambdaMetafactory. metafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType)
Facilitates the creation of simple "function objects" that implement one or more interfaces by delegation to a providedMethodHandle
, after appropriate type adaptation and partial evaluation of arguments.static Object
ConstantBootstraps. nullConstant(MethodHandles.Lookup lookup, String name, Class<?> type)
Returns anull
object reference for the reference type specified bytype
.static Class<?>
ConstantBootstraps. primitiveClass(MethodHandles.Lookup lookup, String name, Class<?> type)
Returns aClass
mirror for the primitive type whose type descriptor is specified byname
.static MethodHandles.Lookup
MethodHandles. privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller)
Returns alookup
object on a target class to emulate all supported bytecode behaviors, including private access.<T extends Member>
TMethodHandleInfo. reflectAs(Class<T> expected, MethodHandles.Lookup lookup)
Reflects the underlying member as a method, constructor, or field object.VarHandle
VarHandle.VarHandleDesc. resolveConstantDesc(MethodHandles.Lookup lookup)
static VarHandle
ConstantBootstraps. staticFieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType)
Finds aVarHandle
for a static field. -
Uses of MethodHandles.Lookup in java.lang.runtime
Methods in java.lang.runtime with parameters of type MethodHandles.Lookup Modifier and Type Method Description static Object
ObjectMethods. bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type, Class<?> recordClass, String names, MethodHandle... getters)
Bootstrap method to generate theObject.equals(Object)
,Object.hashCode()
, andObject.toString()
methods, based on a description of the component names and accessor methods, for eitherinvokedynamic
call sites or dynamic constant pool entries.