Class LambdaInfo

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

public class LambdaInfo extends Object
Lambda Information Holder Lambda信息持有者

Holds metadata extracted from a serialized lambda expression.

持有从序列化lambda表达式提取的元数据。

Features | 主要功能:

  • Lambda implementation class discovery - Lambda实现类发现
  • Implementation method access - 实现方法访问
  • SerializedLambda metadata extraction - SerializedLambda元数据提取

Usage Examples | 使用示例:

LambdaInfo info = LambdaInfo.from((SerializableFunction<User, String>) User::getName);
String methodName = info.getImplMethodName();
Class<?> implClass = info.getImplClass();

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:
  • Constructor Details

    • LambdaInfo

      public LambdaInfo(SerializedLambda serializedLambda, Class<?> implClass, Method implMethod)
      Creates a LambdaInfo 创建LambdaInfo
      Parameters:
      serializedLambda - the serialized lambda | 序列化的lambda
      implClass - the implementation class | 实现类
      implMethod - the implementation method | 实现方法
  • Method Details

    • from

      public static LambdaInfo from(Serializable lambda)
      Creates LambdaInfo from a serializable lambda 从可序列化lambda创建LambdaInfo
      Parameters:
      lambda - the lambda | lambda
      Returns:
      the LambdaInfo | LambdaInfo
    • getFunctionalInterfaceClassName

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

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

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

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

      public Class<?> getImplClass()
      Gets the implementation class 获取实现类
      Returns:
      the implementation class | 实现类
    • getImplMethod

      public Method getImplMethod()
      Gets the implementation method 获取实现方法
      Returns:
      the implementation method or null | 实现方法或null
    • getCapturedArgCount

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

      public Object getCapturedArg(int index)
      Gets a captured argument 获取捕获的参数
      Parameters:
      index - the index | 索引
      Returns:
      the captured argument | 捕获的参数
    • getCapturedArgs

      public Object[] getCapturedArgs()
      Gets all captured arguments 获取所有捕获的参数
      Returns:
      array of captured arguments | 捕获参数数组
    • getSerializedLambda

      public SerializedLambda getSerializedLambda()
      Gets the underlying SerializedLambda 获取底层SerializedLambda
      Returns:
      the SerializedLambda | SerializedLambda
    • isMethodReference

      public boolean isMethodReference()
      Checks if this is a method reference 检查是否为方法引用
      Returns:
      true if method reference | 如果是方法引用返回true
    • getImplMethodKind

      public int getImplMethodKind()
      Gets the impl method kind 获取实现方法类型
      Returns:
      the method kind | 方法类型
    • toString

      public String toString()
      Overrides:
      toString in class Object