-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathAbstractPlayerBuilder.java
91 lines (83 loc) · 2.03 KB
/
AbstractPlayerBuilder.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
package samples;
import javaxfake.annotation.Generated;
import net.karneim.pojobuilder.GwtIncompatible;
@Generated("PojoBuilder")
public abstract class AbstractPlayerBuilder
implements Cloneable {
protected PlayerBuilder self;
protected String value$name$java$lang$String;
protected boolean isSet$name$java$lang$String;
protected int value$points$int;
protected boolean isSet$points$int;
/**
* Creates a new {@link AbstractPlayerBuilder}.
*/
public AbstractPlayerBuilder() {
self = (PlayerBuilder)this;
}
/**
* Sets the default value for the name property.
*
* @param value the default value
* @return this builder
*/
public PlayerBuilder withName(String value) {
this.value$name$java$lang$String = value;
this.isSet$name$java$lang$String = true;
return self;
}
/**
* Sets the default value for the points property.
*
* @param value the default value
* @return this builder
*/
public PlayerBuilder withPoints(int value) {
this.value$points$int = value;
this.isSet$points$int = true;
return self;
}
/**
* Returns a clone of this builder.
*
* @return the clone
*/
@Override
@GwtIncompatible
public Object clone() {
try {
PlayerBuilder result = (PlayerBuilder)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 PlayerBuilder but() {
return (PlayerBuilder)clone();
}
/**
* Creates a new {@link Player} based on this builder's settings.
*
* @return the created Player
*/
public Player build() {
try {
Player result = new Player(value$name$java$lang$String);
if (isSet$points$int) {
result.setPoints(value$points$int);
}
return result;
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}