The Builder uses the creator mode, also known as the Builder mode. In simple terms, an object is created step by step, which shields the user from the details of how the object is constructed, but allows fine control over how the object is constructed.
www.cnblogs.com/ajing2018/p…
Based on using
The @Builder annotation generates a relatively complex Builder API for your class. @Builder lets you call your code to initialize your instance object as shown below:
Student.builder()
.sno( "001" )
.sname( "admin" )
.sage( 18 )
.sphone( "110" )
.build();
Copy the code
@Builder can be placed on a class, constructor, or method. While the patterns placed on classes and on constructors are the most common use cases, @Builder is easiest to explain with use cases placed on methods.
public class TestBuilder { public static void main(String[] args) { JudgedResult build = JudgedResult.builder().result(YinYangResultEnum.Yang).build(); System.out.println(build.getResult()); }} ` ` `Copy the code