Uses of Class
org.miaixz.bus.core.beans.copier.CopyOptions
Packages that use CopyOptions
Package
Description
Bean拷贝实现,包括拷贝选项等
万能类型转换器以及各种类型转换的实现类,其中Convert为转换器入口,提供各种toXXX方法和convert方法
提供各种工具封装
xyz:做好一切必要准备,可以行动了
-
Uses of CopyOptions in org.miaixz.bus.core.beans.copier
Fields in org.miaixz.bus.core.beans.copier declared as CopyOptionsMethods in org.miaixz.bus.core.beans.copier that return CopyOptionsModifier and TypeMethodDescriptionCopyOptions.ignoreCase()设置忽略字段的大小写CopyOptions.ignoreError()设置忽略字段的注入错误CopyOptions.ignoreNullValue()设置忽略空值,当源对象的值为null时,忽略而不注入此值static CopyOptionsCopyOptions.of()创建拷贝选项static CopyOptions创建拷贝选项CopyOptions.setAutoTransCamelCase(boolean autoTransCamelCase) 设置是否自动转换为驼峰方式 一般用于map转bean和bean转bean出现非驼峰格式时,在尝试转换失败的情况下,是否二次检查转为驼峰匹配。 此设置用于解决Bean和Map转换中的匹配问题而设置,并不是一个强制参数。 当map转bean时,如果map中是下划线等非驼峰模式,自动匹配对应的驼峰字段,避免出现字段不拷贝问题。 当bean转bean时,由于字段命名不规范,使用了非驼峰方式,增加兼容性。CopyOptions.setConverter(Converter converter) 设置自定义类型转换器,默认使用全局万能转换器转换。CopyOptions.setEditable(Class<?> editable) 设置限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性CopyOptions.setFieldEditor(UnaryOperator<MutableEntry<String, Object>> editor) 设置字段属性编辑器,用于自定义属性转换规则,例如驼峰转下划线等 此转换器只针对源端的字段做转换,请确认转换后与目标端字段一致 当转换后的字段名为null时忽略这个字段 需要注意的是,当使用ValueProvider作为数据提供者时,这个映射是相反的,即参数中key为目标Bean的名称,而返回值是提供者中的key,并且对值的修改无效CopyOptions.setFieldMapping(Map<String, String> fieldMapping) 设置拷贝属性的字段映射,用于不同的属性之前拷贝做对应表用 需要注意的是,当使用ValueProvider作为数据提供者时,这个映射是相反的,即fieldMapping中key为目标Bean的名称,而value是提供者中的keyCopyOptions.setIgnoreCase(boolean ignoreCase) 设置是否忽略字段的大小写CopyOptions.setIgnoreError(boolean ignoreError) 设置是否忽略字段的注入错误CopyOptions.setIgnoreNullValue(boolean ignoreNullVall) 设置是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入nullCopyOptions.setIgnoreProperties(String... ignoreProperties) 设置忽略的目标对象中属性列表,设置一个属性列表,不拷贝这些属性值<P,R> CopyOptions CopyOptions.setIgnoreProperties(FunctionX<P, R>... funcs) 设置忽略的目标对象中属性列表,设置一个属性列表,不拷贝这些属性值,Lambda方式CopyOptions.setOverride(boolean override) 设置是否覆盖目标值,如果不覆盖,会先读取目标对象的值,为null则写,否则忽略。如果覆盖,则不判断直接写CopyOptions.setPropertiesFilter(BiPredicate<Field, Object> propertiesFilter) CopyOptions.setTransientSupport(boolean transientSupport) 设置是否支持transient关键字修饰和@Transient注解,如果支持,被修饰的字段或方法对应的字段将被忽略。Methods in org.miaixz.bus.core.beans.copier with parameters of type CopyOptionsModifier and TypeMethodDescriptionstatic <T> BeanCopier<T> BeanCopier.of(Object source, T target, Type destType, CopyOptions copyOptions) 创建BeanCopierstatic <T> BeanCopier<T> BeanCopier.of(Object source, T target, CopyOptions copyOptions) 创建BeanCopierConstructors in org.miaixz.bus.core.beans.copier with parameters of type CopyOptionsModifierConstructorDescriptionAbstractCopier(S source, T target, CopyOptions copyOptions) 构造BeanCopier(Object source, T target, Type targetType, CopyOptions copyOptions) 构造BeanToBeanCopier(S source, T target, Type targetType, CopyOptions copyOptions) 构造BeanToMapCopier(Object source, Map target, Type targetType, CopyOptions copyOptions) 构造MapToBeanCopier(Map<?, ?> source, T target, Type targetType, CopyOptions copyOptions) 构造MapToMapCopier(Map source, Map target, Type targetType, CopyOptions copyOptions) 构造ValueProviderToBeanCopier(ValueProvider<String> source, T target, Type targetType, CopyOptions copyOptions) 构造 -
Uses of CopyOptions in org.miaixz.bus.core.convert
Constructors in org.miaixz.bus.core.convert with parameters of type CopyOptions -
Uses of CopyOptions in org.miaixz.bus.core.xyz
Methods in org.miaixz.bus.core.xyz with parameters of type CopyOptionsModifier and TypeMethodDescription对象转Map 通过自定义CopyOptions完成抓换选项,以便实现:static <T> TBeanKit.copyProperties(Object source, T target, CopyOptions copyOptions) 复制Bean对象属性 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类static <T> List<T> BeanKit.copyToList(Collection<?> collection, Class<T> targetType, CopyOptions copyOptions) 复制集合中的Bean属性 此方法遍历集合中每个Bean,复制其属性后加入一个新的List中。static <T> TBeanKit.fillBean(T bean, ValueProvider<String> valueProvider, CopyOptions copyOptions) 填充Bean的核心方法static <T> TBeanKit.fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) 使用Map填充Bean对象static <T> TBeanKit.toBean(Object source, Class<T> clazz, CopyOptions options) 对象或Map转Beanstatic <T> TBeanKit.toBean(Object source, Supplier<T> targetSupplier, CopyOptions options) 对象或Map转Bean