Class BeanCopier<S,T>
java.lang.Object
cloud.opencode.base.reflect.bean.BeanCopier<S,T>
- Type Parameters:
S- the source type | 源类型T- the target type | 目标类型
Bean Copier
Bean复制器
High-performance bean property copier.
高性能bean属性复制器。
Features | 主要功能:
- Property mapping and renaming - 属性映射和重命名
- Custom converters - 自定义转换器
- Property exclusion and null filtering - 属性排除和null过滤
- Batch list copying - 批量列表复制
Usage Examples | 使用示例:
BeanCopier<UserDTO, User> copier = BeanCopier.builder(UserDTO.class, User.class)
.map("userName", "name")
.exclude("password")
.ignoreNulls(true)
.build();
User user = copier.copy(dto);
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: Configurable (ignoreNulls option) - 空值安全: 可配置(ignoreNulls选项)
- Since:
- JDK 25, opencode-base-reflect V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for BeanCopier BeanCopier构建器 -
Method Summary
Modifier and TypeMethodDescriptionstatic <S,T> BeanCopier.Builder <S, T> Creates a BeanCopier builder 创建BeanCopier构建器Copies and creates a new target instance 复制并创建新的目标实例voidCopies properties from source to target 从源复制属性到目标Copies a list of objects 复制对象列表static <S,T> BeanCopier <S, T> Creates a simple BeanCopier 创建简单BeanCopierGets the source class 获取源类Gets the target class 获取目标类
-
Method Details
-
builder
Creates a BeanCopier builder 创建BeanCopier构建器- Type Parameters:
S- the source type | 源类型T- the target type | 目标类型- Parameters:
sourceClass- the source class | 源类targetClass- the target class | 目标类- Returns:
- the builder | 构建器
-
create
Creates a simple BeanCopier 创建简单BeanCopier- Type Parameters:
S- the source type | 源类型T- the target type | 目标类型- Parameters:
sourceClass- the source class | 源类targetClass- the target class | 目标类- Returns:
- the copier | 复制器
-
copy
-
copy
-
copyList
-
getSourceClass
-
getTargetClass
-