Class BeanCopier.Copier

java.lang.Object
com.sure.tool.bean.BeanCopier.Copier
Enclosing class:
BeanCopier

public static final class BeanCopier.Copier extends Object
链式拷贝器:可组合忽略策略与字段白名单/黑名单。
Since:
1.18.0
  • Method Details

    • ignoreNull

      public BeanCopier.Copier ignoreNull()
      源属性值为 null 时跳过。
      Returns:
      this
    • ignoreReadonly

      public BeanCopier.Copier ignoreReadonly()
      目标属性只读时跳过(默认抛 CopyException)。
      Returns:
      this
    • deep

      public BeanCopier.Copier deep()
      深拷贝(嵌套 Bean / 集合 / 数组递归)。
      Returns:
      this
    • include

      public BeanCopier.Copier include(String... fields)
      仅拷贝指定字段(白名单)。
      Parameters:
      fields - 字段名
      Returns:
      this
    • exclude

      public BeanCopier.Copier exclude(String... fields)
      跳过指定字段(黑名单)。
      Parameters:
      fields - 字段名
      Returns:
      this
    • to

      public <T> T to(Class<T> targetClass)
      拷贝为新目标对象。
      Type Parameters:
      T - 目标类型
      Parameters:
      targetClass - 目标类型
      Returns:
      新目标对象
    • to

      public void to(Object target)
      拷贝到已有目标对象。
      Parameters:
      target - 目标对象