类 MethodHandleUtils
- java.lang.Object
-
- io.microsphere.util.BaseUtils
-
- io.microsphere.invoke.MethodHandleUtils
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
MethodHandleUtils.LookupMode
The allowedMethodHandles.Lookup
modes enumeration
-
字段概要
字段 修饰符和类型 字段 说明 static int
ALL_MODES
A single-bit mask representing all accesses (public, private, protected and package) The value, 0x0f, happens to be the same as the value of the modifier bit.static int
MODULE
A single-bit mask representingmodule
access, which may contribute to the result oflookupModes
.static java.lang.invoke.MethodHandle
NOT_FOUND_METHOD_HANDLE
MethodHandle
for Not-Foundstatic int
ORIGINAL
A single-bit mask representingoriginal
access which may contribute to the result oflookupModes
.static int
PACKAGE
A single-bit mask representingpackage
access (default access), which may contribute to the result oflookupModes
.static int
PRIVATE
A single-bit mask representingprivate
access, which may contribute to the result oflookupModes
.static int
PROTECTED
A single-bit mask representingprotected
access, which may contribute to the result oflookupModes
.static int
PUBLIC
A single-bit mask representingpublic
access, which may contribute to the result oflookupModes
.static int
UNCONDITIONAL
A single-bit mask representingunconditional
access which may contribute to the result oflookupModes
.
-
构造器概要
构造器 构造器 说明 MethodHandleUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 protected static java.lang.invoke.MethodHandle
find(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class[] parameterTypes, ThrowableBiFunction<java.lang.invoke.MethodHandles.Lookup,java.lang.invoke.MethodType,java.lang.invoke.MethodHandle> function)
static java.lang.invoke.MethodHandle
findStatic(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class... parameterTypes)
The convenient method to findMethodHandles.Lookup.findStatic(Class, String, MethodType)
static java.lang.invoke.MethodHandle
findVirtual(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class... parameterTypes)
The convenient method to findMethodHandles.Lookup.findVirtual(Class, String, MethodType)
static java.lang.invoke.MethodHandles.Lookup
lookup(java.lang.Class<?> lookupClass)
Create an instance ofMethodHandles.Lookup
by the specified lookup class withall accesses (public, private, protected and package)
static java.lang.invoke.MethodHandles.Lookup
lookup(java.lang.Class<?> lookupClass, MethodHandleUtils.LookupMode... lookupModes)
Create an instance ofMethodHandles.Lookup
by the specified lookup class withall access (public, private, protected and package)
-
-
-
字段详细资料
-
PUBLIC
public static final int PUBLIC
A single-bit mask representingpublic
access, which may contribute to the result oflookupModes
. The value,0x01
, happens to be the same as the value of thepublic
modifier bit.A
Lookup
with this lookup mode performs cross-module access check with respect to the lookup class and previous lookup class if present.- 另请参阅:
MethodHandles.Lookup.PUBLIC
, 常量字段值
-
PRIVATE
public static final int PRIVATE
A single-bit mask representingprivate
access, which may contribute to the result oflookupModes
. The value,0x02
, happens to be the same as the value of theprivate
modifier bit.- 另请参阅:
MethodHandles.Lookup.PRIVATE
, 常量字段值
-
PROTECTED
public static final int PROTECTED
A single-bit mask representingprotected
access, which may contribute to the result oflookupModes
. The value,0x04
, happens to be the same as the value of theprotected
modifier bit.- 另请参阅:
MethodHandles.Lookup.PROTECTED
, 常量字段值
-
PACKAGE
public static final int PACKAGE
A single-bit mask representingpackage
access (default access), which may contribute to the result oflookupModes
. The value is0x08
, which does not correspond meaningfully to any particular modifier bit.- 另请参阅:
MethodHandles.Lookup.PACKAGE
, 常量字段值
-
MODULE
public static final int MODULE
A single-bit mask representingmodule
access, which may contribute to the result oflookupModes
. The value is0x10
, which does not correspond meaningfully to any particular modifier bit. In conjunction with thePUBLIC
modifier bit, aLookup
with this lookup mode can access all public types in the module of the lookup class and public types in packages exported by other modules to the module of the lookup class.If this lookup mode is set, the previous lookup class is always
null
.- 从以下版本开始:
- 9
- 另请参阅:
MethodHandles.Lookup#MODULE
, 常量字段值
-
UNCONDITIONAL
public static final int UNCONDITIONAL
A single-bit mask representingunconditional
access which may contribute to the result oflookupModes
. The value is0x20
, which does not correspond meaningfully to any particular modifier bit. ALookup
with this lookup mode assumes readability. This lookup mode can access all public members of public types of all modules when the type is in a package that isexported unconditionally
.If this lookup mode is set, the previous lookup class is always
null
.- 从以下版本开始:
- 9
- 另请参阅:
MethodHandles.publicLookup()
,MethodHandles.Lookup#UNCONDITIONAL
, 常量字段值
-
ORIGINAL
public static final int ORIGINAL
A single-bit mask representingoriginal
access which may contribute to the result oflookupModes
. The value is0x40
, which does not correspond meaningfully to any particular modifier bit.If this lookup mode is set, the
Lookup
object must be created by the original lookup class by callingMethodHandles.lookup()
method or by a bootstrap method invoked by the VM. TheLookup
object with this lookup mode has full privilege access.- 从以下版本开始:
- 16
- 另请参阅:
MethodHandles.Lookup#ORIGINAL
, 常量字段值
-
ALL_MODES
public static final int ALL_MODES
A single-bit mask representing all accesses (public, private, protected and package) The value, 0x0f, happens to be the same as the value of the modifier bit.- 另请参阅:
- 常量字段值
-
NOT_FOUND_METHOD_HANDLE
public static final java.lang.invoke.MethodHandle NOT_FOUND_METHOD_HANDLE
MethodHandle
for Not-Found
-
-
方法详细资料
-
lookup
public static java.lang.invoke.MethodHandles.Lookup lookup(java.lang.Class<?> lookupClass)
Create an instance ofMethodHandles.Lookup
by the specified lookup class withall accesses (public, private, protected and package)
- 参数:
lookupClass
- the lookup class- 返回:
- non-null
-
lookup
public static java.lang.invoke.MethodHandles.Lookup lookup(java.lang.Class<?> lookupClass, MethodHandleUtils.LookupMode... lookupModes)
Create an instance ofMethodHandles.Lookup
by the specified lookup class withall access (public, private, protected and package)
- 参数:
lookupClass
- the lookup class- 返回:
- non-null
-
findVirtual
public static java.lang.invoke.MethodHandle findVirtual(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class... parameterTypes)
The convenient method to findMethodHandles.Lookup.findVirtual(Class, String, MethodType)
- 参数:
lookupClass
- the class to be looked upmethodName
- the target method nameparameterTypes
- the types of target method parameters- 返回:
MethodHandle
-
findStatic
public static java.lang.invoke.MethodHandle findStatic(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class... parameterTypes)
The convenient method to findMethodHandles.Lookup.findStatic(Class, String, MethodType)
- 参数:
lookupClass
- the class to be looked upmethodName
- the target method nameparameterTypes
- the types of target method parameters- 返回:
MethodHandle
-
find
protected static java.lang.invoke.MethodHandle find(java.lang.Class<?> lookupClass, java.lang.String methodName, java.lang.Class[] parameterTypes, ThrowableBiFunction<java.lang.invoke.MethodHandles.Lookup,java.lang.invoke.MethodType,java.lang.invoke.MethodHandle> function)
-
-