-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathContactBuilder.java
105 lines (96 loc) · 2.54 KB
/
ContactBuilder.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
95
96
97
98
99
100
101
102
103
104
105
package samples;
import javaxfake.annotation.Generated;
import net.karneim.pojobuilder.GwtIncompatible;
@Generated("PojoBuilder")
public class ContactBuilder
implements Cloneable {
protected ContactBuilder self;
protected String value$surname$java$lang$String;
protected boolean isSet$surname$java$lang$String;
protected String value$firstname$java$lang$String;
protected boolean isSet$firstname$java$lang$String;
protected String value$email$java$lang$String;
protected boolean isSet$email$java$lang$String;
/**
* Creates a new {@link ContactBuilder}.
*/
public ContactBuilder() {
self = (ContactBuilder)this;
}
/**
* Sets the default value for the surname property.
*
* @param value the default value
* @return this builder
*/
public ContactBuilder withSurname(String value) {
this.value$surname$java$lang$String = value;
this.isSet$surname$java$lang$String = true;
return self;
}
/**
* Sets the default value for the firstname property.
*
* @param value the default value
* @return this builder
*/
public ContactBuilder withFirstname(String value) {
this.value$firstname$java$lang$String = value;
this.isSet$firstname$java$lang$String = true;
return self;
}
/**
* Sets the default value for the email property.
*
* @param value the default value
* @return this builder
*/
public ContactBuilder withEmail(String value) {
this.value$email$java$lang$String = value;
this.isSet$email$java$lang$String = true;
return self;
}
/**
* Returns a clone of this builder.
*
* @return the clone
*/
@Override
@GwtIncompatible
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
*/
@GwtIncompatible
public ContactBuilder but() {
return (ContactBuilder)clone();
}
/**
* Creates a new {@link Contact} based on this builder's settings.
*
* @return the created Contact
*/
public Contact build() {
try {
Contact result = new Contact(value$surname$java$lang$String, value$firstname$java$lang$String);
if (isSet$email$java$lang$String) {
result.setEmail(value$email$java$lang$String);
}
return result;
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}