类的用途
java.lang.invoke.MethodHandles.Lookup
使用 MethodHandles.Lookup 的包
包
描述
提供对 Java 编程语言的设计至关重要的类。
代表 nominal descriptors 运行时实体(例如类或方法句柄)和类文件实体(例如常量池条目或
invokedynamic 调用站点)的类和接口。
java.lang.invoke 包提供用于与 Java 虚拟机交互的低级原语。
java.lang.runtime 包为 Java 语言提供低级运行时支持。
包含用于链接
invokedynamic 调用站点的接口和类。
包含语言运行时所需的接口和类,以实现它们自己的特定于语言的对象模型和类型转换。
包含的类通过提供某些类的基本实现以及各种实用程序,使语言运行时更方便地实现自己的特定于语言的对象模型和类型转换。
-
MethodHandles.Lookup 在 java.lang 中的用法
java.lang 中的方法,参数类型为 MethodHandles.Lookup修饰符和类型方法描述Double.resolveConstantDesc(MethodHandles.Lookup lookup) 将此实例解析为ConstantDesc,其结果是实例本身。Float.resolveConstantDesc(MethodHandles.Lookup lookup) 将此实例解析为ConstantDesc,其结果是实例本身。Integer.resolveConstantDesc(MethodHandles.Lookup lookup) 将此实例解析为ConstantDesc,其结果是实例本身。Long.resolveConstantDesc(MethodHandles.Lookup lookup) 将此实例解析为ConstantDesc,其结果是实例本身。String.resolveConstantDesc(MethodHandles.Lookup lookup) 将此实例解析为ConstantDesc,其结果是实例本身。 -
MethodHandles.Lookup 在 java.lang.constant 中的用法
java.lang.constant 中的方法,参数类型为 MethodHandles.Lookup修饰符和类型方法描述DynamicCallSiteDesc.resolveCallSiteDesc(MethodHandles.Lookup lookup) 以指定参数反射调用 bootstrap 方法,并返回结果CallSiteConstantDesc.resolveConstantDesc(MethodHandles.Lookup lookup) DynamicConstantDesc.resolveConstantDesc(MethodHandles.Lookup lookup) -
MethodHandles.Lookup 在 java.lang.invoke 中的用法
java.lang.invoke 中返回 MethodHandles.Lookup 的方法修饰符和类型方法描述MethodHandles.Lookup.defineHiddenClass(byte[] bytes, boolean initialize, MethodHandles.Lookup.ClassOption... options) 从bytes创建一个 hidden 类或接口,在新创建的类或接口上返回一个Lookup。MethodHandles.Lookup.defineHiddenClassWithClassData(byte[] bytes, Object classData, boolean initialize, MethodHandles.Lookup.ClassOption... options) MethodHandles.Lookup.dropLookupMode(int modeToDrop) 在此查找对象找到成员的同一查找类上创建一个查找,但查找模式已丢失给定的查找模式。在指定的新查找类上创建查找。static MethodHandles.LookupMethodHandles.lookup()返回具有完整功能的lookup object来模拟调用者所有支持的字节码行为。static MethodHandles.LookupMethodHandles.privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller) static MethodHandles.LookupMethodHandles.publicLookup()返回最低信任度的lookup object。java.lang.invoke 中的方法,参数类型为 MethodHandles.Lookup修饰符和类型方法描述static CallSiteLambdaMetafactory.altMetafactory(MethodHandles.Lookup caller, String interfaceMethodName, MethodType factoryType, Object... args) 在适当的类型调整和参数的部分评估之后,通过委托给提供的MethodHandle来促进实现一个或多个接口的简单“函数对象”的创建。static VarHandleConstantBootstraps.arrayVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> arrayClass) 查找数组类型的VarHandle。static <T> TMethodHandles.classData(MethodHandles.Lookup caller, String name, Class<T> type) 返回与给定caller查找对象或null的查找类关联的 class data。static <T> TMethodHandles.classDataAt(MethodHandles.Lookup caller, String name, Class<T> type, int index) static <E extends Enum<E>>
EConstantBootstraps.enumConstant(MethodHandles.Lookup lookup, String name, Class<E> type) 返回一个enum常量,其类型由type指定,名称由name指定。static ObjectConstantBootstraps.explicitCast(MethodHandles.Lookup lookup, String name, Class<?> dstType, Object value) 应用从源类型到目标类型的转换。static VarHandleConstantBootstraps.fieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType) 为实例字段查找VarHandle。static ObjectConstantBootstraps.getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type) 返回在类中声明的与字段类型相同的静态最终字段的值(或者,对于原始值字段,在包装类中声明。)static ObjectConstantBootstraps.getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type, Class<?> declaringClass) 返回静态最终字段的值。static ObjectConstantBootstraps.invoke(MethodHandles.Lookup lookup, String name, Class<?> type, MethodHandle handle, Object... args) 返回使用提供的参数调用方法句柄的结果。static CallSiteStringConcatFactory.makeConcat(MethodHandles.Lookup lookup, String name, MethodType concatType) 促进优化的字符串连接方法的创建,可用于有效地连接已知类型的已知数量的参数,可能在类型适应和参数的部分评估之后。static CallSiteStringConcatFactory.makeConcatWithConstants(MethodHandles.Lookup lookup, String name, MethodType concatType, String recipe, Object... constants) 促进优化的字符串连接方法的创建,可用于有效地连接已知类型的已知数量的参数,可能在类型适应和参数的部分评估之后。static CallSiteLambdaMetafactory.metafactory(MethodHandles.Lookup caller, String interfaceMethodName, MethodType factoryType, MethodType interfaceMethodType, MethodHandle implementation, MethodType dynamicMethodType) 在适当的类型调整和参数的部分评估之后,通过委托给提供的MethodHandle来促进实现一个或多个接口的简单“函数对象”的创建。static ObjectConstantBootstraps.nullConstant(MethodHandles.Lookup lookup, String name, Class<?> type) 为type指定的引用类型返回一个null对象引用。static Class<?>ConstantBootstraps.primitiveClass(MethodHandles.Lookup lookup, String name, Class<?> type) 返回其类型描述符由name指定的原始类型的Class镜像。static MethodHandles.LookupMethodHandles.privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller) <T extends Member>
TMethodHandleInfo.reflectAs(Class<T> expected, MethodHandles.Lookup lookup) 将基础成员反映为方法、构造方法或字段对象。static VarHandleConstantBootstraps.staticFieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType) 为静态字段查找VarHandle。 -
MethodHandles.Lookup 在 java.lang.runtime 中的用法
java.lang.runtime 中的方法,参数类型为 MethodHandles.Lookup修饰符和类型方法描述static ObjectObjectMethods.bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type, Class<?> recordClass, String names, MethodHandle... getters) Bootstrap 方法根据组件名称和访问器方法的描述为invokedynamic调用站点或动态常量池条目生成Object.equals(Object)、Object.hashCode()和Object.toString()方法。static CallSiteSwitchBootstraps.enumSwitch(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, Object... labels) 用于链接在枚举类型的目标上实现switch的invokedynamic调用站点的引导方法。static CallSiteSwitchBootstraps.typeSwitch(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, Object... labels) 用于链接在引用类型的目标上实现switch的invokedynamic调用站点的引导方法。 -
MethodHandles.Lookup 在 jdk.dynalink 中的用法
jdk.dynalink 中返回 MethodHandles.Lookup 的方法修饰符和类型方法描述final MethodHandles.LookupSecureLookupSupplier.getLookup()返回由此SecureLookupSupplier保护的查找。protected final MethodHandles.LookupSecureLookupSupplier.getLookupPrivileged()返回SecureLookupSupplier.getLookup()的值而不进行安全检查。jdk.dynalink 中的构造函数,参数类型为 MethodHandles.Lookup修饰符构造方法描述CallSiteDescriptor(MethodHandles.Lookup lookup, Operation operation, MethodType methodType) 创建一个新的调用站点描述符。创建一个新的安全查找供应商,保护传递的查找。 -
MethodHandles.Lookup 在 jdk.dynalink.linker 中的用法
jdk.dynalink.linker 中的方法参数,类型参数为 MethodHandles.Lookup修饰符和类型方法描述GuardingTypeConverterFactory.convertToType(Class<?> sourceType, Class<?> targetType, Supplier<MethodHandles.Lookup> lookupSupplier) 返回一个受保护的类型转换,它接收指定源类型的值并返回转换为指定目标类型的值。 -
MethodHandles.Lookup 在 jdk.dynalink.linker.support 中的用法
jdk.dynalink.linker.support 中的方法,参数类型为 MethodHandles.Lookup修饰符和类型方法描述static MethodHandleLookup.findOwnSpecial(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) 给定一个查找,使用Lookup.findSpecial(Class, String, MethodType)查找该查找类的方法。static MethodHandleLookup.findOwnStatic(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes) 给定一个查找,使用Lookup.findStatic(Class, String, MethodType)查找该查找类的方法。static MethodHandleLookup.unreflect(MethodHandles.Lookup lookup, Method m) static MethodHandleLookup.unreflectConstructor(MethodHandles.Lookup lookup, Constructor<?> c) jdk.dynalink.linker.support 中的构造函数,参数类型为 MethodHandles.Lookup