Class SerializedLambdaWrapper

java.lang.Object
cloud.opencode.base.reflect.lambda.SerializedLambdaWrapper

public final class SerializedLambdaWrapper extends Object
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 Details

    • from

      public static SerializedLambdaWrapper from(Serializable lambda)
      Creates a wrapper from a serializable lambda 从可序列化lambda创建包装器
      Parameters:
      lambda - the lambda | lambda
      Returns:
      the wrapper | 包装器
    • fromSafe

      public static Optional<SerializedLambdaWrapper> fromSafe(Serializable lambda)
      Creates a wrapper safely 安全创建包装器
      Parameters:
      lambda - the lambda | lambda
      Returns:
      Optional of wrapper | 包装器的Optional
    • getCapturingClass

      public String getCapturingClass()
      Gets the capturing class 获取捕获类
      Returns:
      the capturing class name | 捕获类名
    • getFunctionalInterfaceClass

      public String getFunctionalInterfaceClass()
      Gets the functional interface class 获取函数式接口类
      Returns:
      the functional interface class name | 函数式接口类名
    • getFunctionalInterfaceMethodName

      public String getFunctionalInterfaceMethodName()
      Gets the functional interface method name 获取函数式接口方法名
      Returns:
      the method name | 方法名
    • getFunctionalInterfaceMethodSignature

      public String getFunctionalInterfaceMethodSignature()
      Gets the functional interface method signature 获取函数式接口方法签名
      Returns:
      the method signature | 方法签名
    • getImplClass

      public String getImplClass()
      Gets the implementation class 获取实现类
      Returns:
      the implementation class name | 实现类名
    • getImplMethodName

      public String getImplMethodName()
      Gets the implementation method name 获取实现方法名
      Returns:
      the method name | 方法名
    • getImplMethodSignature

      public String getImplMethodSignature()
      Gets the implementation method signature 获取实现方法签名
      Returns:
      the method signature | 方法签名
    • getImplMethodKind

      public int getImplMethodKind()
      Gets the implementation method kind 获取实现方法种类
      Returns:
      the method kind | 方法种类
    • getInstantiatedMethodType

      public String getInstantiatedMethodType()
      Gets the instantiated method type 获取实例化方法类型
      Returns:
      the method type | 方法类型
    • getCapturedArgCount

      public int getCapturedArgCount()
      Gets the captured argument count 获取捕获参数数量
      Returns:
      the count | 数量
    • getCapturedArg

      public Object getCapturedArg(int index)
      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

      public String getPropertyName()
      Gets the property name (for getter/setter method references) 获取属性名(用于getter/setter方法引用)
      Returns:
      the property name | 属性名
    • getImplClassAsClass

      public Class<?> getImplClassAsClass()
      Gets the implementation class as Class object 获取实现类作为Class对象
      Returns:
      the class | 类
    • getImplMethod

      public Optional<Method> getImplMethod()
      Gets the implementation method 获取实现方法
      Returns:
      Optional of method | 方法的Optional
    • unwrap

      public SerializedLambda unwrap()
      Gets the underlying SerializedLambda 获取底层SerializedLambda
      Returns:
      the SerializedLambda | SerializedLambda
    • toString

      public String toString()
      Overrides:
      toString in class Object