Interface SerializableFunction<T,R>
- Type Parameters:
T- the input type | 输入类型R- the output type | 输出类型
- All Superinterfaces:
Function<T,R>, Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Serializable Function Interface
可序列化Function接口
A Function that is also Serializable, enabling lambda metadata extraction.
一个同时也是Serializable的Function,可以提取lambda元数据。
Features | 主要功能:
- Serializable Function for lambda metadata extraction - 可序列化Function用于lambda元数据提取
- Composable with compose and andThen - 可通过compose和andThen组合
- Identity factory method - 恒等函数工厂方法
Usage Examples | 使用示例:
SerializableFunction<User, String> getName = User::getName;
String name = getName.apply(user);
Security | 安全性:
- Thread-safe: Depends on implementation - 线程安全: 取决于实现
- Null-safe: Depends on implementation - 空值安全: 取决于实现
- Since:
- JDK 25, opencode-base-reflect V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault <V> SerializableFunction<T, V> andThen(SerializableFunction<? super R, ? extends V> after) Composes this function with another (after) 将此函数与另一个组合(之后)default <V> SerializableFunction<V, R> compose(SerializableFunction<? super V, ? extends T> before) Composes this function with another (before) 将此函数与另一个组合(之前)static <T> SerializableFunction<T, T> identity()Creates an identity function 创建恒等函数static <T,R> SerializableFunction <T, R> of(SerializableFunction<T, R> function) Creates a SerializableFunction from a regular Function 从普通Function创建SerializableFunction
-
Method Details
-
of
Creates a SerializableFunction from a regular Function 从普通Function创建SerializableFunction- Type Parameters:
T- the input type | 输入类型R- the output type | 输出类型- Parameters:
function- the function | 函数- Returns:
- the serializable function | 可序列化函数
-
identity
Creates an identity function 创建恒等函数- Type Parameters:
T- the type | 类型- Returns:
- the identity function | 恒等函数
-
compose
Composes this function with another (before) 将此函数与另一个组合(之前)- Type Parameters:
V- the input type of before | before的输入类型- Parameters:
before- the function to apply before | 之前应用的函数- Returns:
- the composed function | 组合后的函数
-
andThen
Composes this function with another (after) 将此函数与另一个组合(之后)- Type Parameters:
V- the output type of after | after的输出类型- Parameters:
after- the function to apply after | 之后应用的函数- Returns:
- the composed function | 组合后的函数
-