forked from mkarneim/pojobuilder
/
AbstractContactBuilder.java
94 lines (80 loc) · 2.31 KB
/
AbstractContactBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package samples.with.generationgap;
import java.util.List;
import samples.with.generationgap.Contact;
import javax.annotation.Generated;
/**
* The {@link AbstractContactBuilder} is a Builder for {@link Contact} objects.
*
* <p>
* This class has been generated.
* Please DO NOT MODIFIY this file
* since it will be overwritten
* by the PojoBuilder generator.
* </p>
*/
@Generated("PojoBuilder")
public abstract class AbstractContactBuilder implements Cloneable {
protected ContactBuilder self;
protected List<String> value$emailAddresses$java$util$List;
protected boolean isSet$emailAddresses$java$util$List = false;
protected String value$name$java$lang$String; // mandatory constructor parameter
protected boolean isSet$name$java$lang$String = false;
/**
* Creates a new {@link AbstractContactBuilder}.
*/
public AbstractContactBuilder() {
self = (ContactBuilder)this;
}
/**
* Sets the default value for the {@link Contact#emailAddresses} property.
* @param value the default value
* @return this builder
*/
public ContactBuilder withEmailAddresses( List<String> value) {
this.value$emailAddresses$java$util$List = value;
this.isSet$emailAddresses$java$util$List = true;
return self;
}
/**
* Sets the default value for the {@link Contact#name} property.
* @param value the default value
* @return this builder
*/
public ContactBuilder withName( String value) {
this.value$name$java$lang$String = value;
this.isSet$name$java$lang$String = true;
return self;
}
/**
* Returns a clone of this builder.
* @return the clone
*/
@Override
public Object clone() {
try {
ContactBuilder result = (ContactBuilder)super.clone();
result.self = result;
return result;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.getMessage());
}
}
/**
* Returns a clone of this builder.
* @return the clone
*/
public ContactBuilder but() {
return (ContactBuilder)clone();
}
/**
* Creates a new {@link Contact} based on this builder's settings.
* @return the created Contact
*/
public Contact build() {
Contact result = new Contact( this.value$name$java$lang$String );
if ( this.isSet$emailAddresses$java$util$List) {
result.setEmailAddresses( this.value$emailAddresses$java$util$List);
}
return result;
}
}