Class SerializedLambdaWrapper
java.lang.Object
cloud.opencode.base.reflect.lambda.SerializedLambdaWrapper
SerializedLambda Wrapper Class
SerializedLambda包装类
Provides a convenient wrapper around java.lang.invoke.SerializedLambda.
提供java.lang.invoke.SerializedLambda的便捷包装。
Features | 主要功能:
- SerializedLambda wrapping with convenience methods - SerializedLambda便捷方法包装
- Implementation class and method resolution - 实现类和方法解析
Usage Examples | 使用示例:
SerializedLambdaWrapper wrapper = SerializedLambdaWrapper.of(lambda);
String methodName = wrapper.getImplMethodName();
Optional<Method> method = wrapper.getImplMethod();
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (lambda must be non-null and serializable) - 空值安全: 否(lambda须非空且可序列化)
- Since:
- JDK 25, opencode-base-reflect V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic SerializedLambdaWrapperfrom(Serializable lambda) Creates a wrapper from a serializable lambda 从可序列化lambda创建包装器static Optional<SerializedLambdaWrapper> fromSafe(Serializable lambda) Creates a wrapper safely 安全创建包装器getCapturedArg(int index) Gets a captured argument 获取捕获参数intGets the captured argument count 获取捕获参数数量Gets the capturing class 获取捕获类Gets the functional interface class 获取函数式接口类Gets the functional interface method name 获取函数式接口方法名Gets the functional interface method signature 获取函数式接口方法签名Gets the implementation class 获取实现类Class<?> Gets the implementation class as Class object 获取实现类作为Class对象Gets the implementation method 获取实现方法intGets the implementation method kind 获取实现方法种类Gets the implementation method name 获取实现方法名Gets the implementation method signature 获取实现方法签名Gets the instantiated method type 获取实例化方法类型Gets the property name (for getter/setter method references) 获取属性名(用于getter/setter方法引用)booleanChecks if this is a constructor reference 检查是否为构造器引用booleanChecks if this is an instance method reference 检查是否为实例方法引用booleanChecks if this is a method reference 检查是否为方法引用booleanChecks if this is a static method reference 检查是否为静态方法引用toString()unwrap()Gets the underlying SerializedLambda 获取底层SerializedLambda
-
Method Details
-
from
Creates a wrapper from a serializable lambda 从可序列化lambda创建包装器- Parameters:
lambda- the lambda | lambda- Returns:
- the wrapper | 包装器
-
fromSafe
Creates a wrapper safely 安全创建包装器- Parameters:
lambda- the lambda | lambda- Returns:
- Optional of wrapper | 包装器的Optional
-
getCapturingClass
Gets the capturing class 获取捕获类- Returns:
- the capturing class name | 捕获类名
-
getFunctionalInterfaceClass
Gets the functional interface class 获取函数式接口类- Returns:
- the functional interface class name | 函数式接口类名
-
getFunctionalInterfaceMethodName
Gets the functional interface method name 获取函数式接口方法名- Returns:
- the method name | 方法名
-
getFunctionalInterfaceMethodSignature
Gets the functional interface method signature 获取函数式接口方法签名- Returns:
- the method signature | 方法签名
-
getImplClass
Gets the implementation class 获取实现类- Returns:
- the implementation class name | 实现类名
-
getImplMethodName
Gets the implementation method name 获取实现方法名- Returns:
- the method name | 方法名
-
getImplMethodSignature
Gets the implementation method signature 获取实现方法签名- Returns:
- the method signature | 方法签名
-
getImplMethodKind
public int getImplMethodKind()Gets the implementation method kind 获取实现方法种类- Returns:
- the method kind | 方法种类
-
getInstantiatedMethodType
Gets the instantiated method type 获取实例化方法类型- Returns:
- the method type | 方法类型
-
getCapturedArgCount
public int getCapturedArgCount()Gets the captured argument count 获取捕获参数数量- Returns:
- the count | 数量
-
getCapturedArg
Gets a captured argument 获取捕获参数- Parameters:
index- the index | 索引- Returns:
- the captured argument | 捕获参数
-
isMethodReference
public boolean isMethodReference()Checks if this is a method reference 检查是否为方法引用- Returns:
- true if method reference | 如果是方法引用返回true
-
isStaticMethodReference
public boolean isStaticMethodReference()Checks if this is a static method reference 检查是否为静态方法引用- Returns:
- true if static | 如果是静态返回true
-
isConstructorReference
public boolean isConstructorReference()Checks if this is a constructor reference 检查是否为构造器引用- Returns:
- true if constructor | 如果是构造器返回true
-
isInstanceMethodReference
public boolean isInstanceMethodReference()Checks if this is an instance method reference 检查是否为实例方法引用- Returns:
- true if instance method | 如果是实例方法返回true
-
getPropertyName
Gets the property name (for getter/setter method references) 获取属性名(用于getter/setter方法引用)- Returns:
- the property name | 属性名
-
getImplClassAsClass
Gets the implementation class as Class object 获取实现类作为Class对象- Returns:
- the class | 类
-
getImplMethod
-
unwrap
Gets the underlying SerializedLambda 获取底层SerializedLambda- Returns:
- the SerializedLambda | SerializedLambda
-
toString
-