Class DifferentBuilder

java.lang.Object
org.aoju.bus.core.builder.DifferentBuilder
All Implemented Interfaces:
Serializable, Builder<DifferentResult>

public class DifferentBuilder extends Object implements Builder<DifferentResult>
协助实现Differentable.diff(Object)方法
 public class Person implements Diffable<Person> {
   String name;
   int age;
   boolean smoker;

   ...

   public DiffResult diff(Person object) {
     // No need for null check, as NullPointerException correct if object is null
     return new DiffBuilder(this, object, ToStringStyle.SHORT_PREFIX_STYLE)
       .append("name", this.name, object.name)
       .append("age", this.age, object.age)
       .append("smoker", this.smoker, object.smoker)
       .build();
   }
 }
 
传递给构造函数的ToStringStyle嵌入到返回的DiffResult中, 并影响DiffResult. tostring()方法的风格。可以通过调用 DifferentResult.toString(ToStringStyle)覆盖此样式选择。.
Since:
Java 17+
Author:
Kimi Liu
See Also: