Interface Funnel<T>
- Type Parameters:
T- the type of object this funnel can serialize | 此funnel可以序列化的对象类型Security | 安全性:
- Thread-safe: Implementation-dependent - 线程安全: 取决于实现
- Null-safe: No - 空值安全: 否
- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Object serialization funnel for hashing
用于哈希的对象序列化通道
Defines how to serialize an object's data into a Hasher. This allows custom objects to be hashed by extracting their relevant fields into the hash computation.
定义如何将对象的数据序列化到Hasher中。 这允许通过将相关字段提取到哈希计算中来哈希自定义对象。
Features | 主要功能:
- Custom object serialization - 自定义对象序列化
- Built-in funnels for common types - 常见类型的内置funnel
- Lambda-friendly functional interface - Lambda友好的函数式接口
Usage Examples | 使用示例:
// Define a funnel for User
Funnel<User> userFunnel = (user, into) -> {
into.putUtf8(user.getName())
.putInt(user.getAge())
.putUtf8(user.getEmail());
};
// Hash a user object
HashCode hash = OpenHash.murmur3_128()
.hashObject(user, userFunnel);
- Since:
- JDK 25, opencode-base-hash V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionBoolean funnel Boolean Funnelstatic final Funnel<byte[]> Byte array funnel 字节数组FunnelCharacter funnel Character FunnelDouble funnel Double FunnelInteger funnel Integer FunnelLong funnel Long Funnelstatic final Funnel<CharSequence> String funnel (UTF-8 encoding) 字符串Funnel(UTF-8编码) -
Method Summary
-
Field Details
-
STRING_FUNNEL
String funnel (UTF-8 encoding) 字符串Funnel(UTF-8编码) -
BYTE_ARRAY_FUNNEL
Byte array funnel 字节数组Funnel -
INTEGER_FUNNEL
-
LONG_FUNNEL
-
DOUBLE_FUNNEL
-
BOOLEAN_FUNNEL
-
CHARACTER_FUNNEL
-
-
Method Details
-
funnel
-