Java 8 consumer风格Builder
2021-05-01 07:28
标签:icon lis object etag bic clear ant return function 使用: Java 8 consumer风格Builder 标签:icon lis object etag bic clear ant return function 原文地址:https://www.cnblogs.com/Joynic/p/13220858.html 1 public static class GenericBuilder
1 public class Dummy {
2 private String name;
3 private Integer age;
4 private Boolean foreigner;
5
6 public String getName() {
7 return name;
8 }
9
10 public void setName(String name) {
11 this.name = name;
12 }
13
14 public Integer getAge() {
15 return age;
16 }
17
18 public void setAge(Integer age) {
19 this.age = age;
20 }
21
22 public Boolean getForeigner() {
23 return foreigner;
24 }
25
26 public void setForeigner(Boolean foreigner) {
27 this.foreigner = foreigner;
28 }
29
30
31 }
Dummy build = GenericBuilder.of(Dummy::new).with(Dummy::setAge, 12)
.with(Dummy::setName, "Vodoo")
.with(Dummy::setForeigner, false).build();
文章标题:Java 8 consumer风格Builder
文章链接:http://soscw.com/index.php/essay/80766.html