2222import java .util .Map ;
2323import java .util .Objects ;
2424import java .util .Optional ;
25- import org .jetbrains .annotations .NotNull ;
2625
2726@ JsonInclude (JsonInclude .Include .NON_ABSENT )
2827@ JsonDeserialize (
2928 builder = LeaderboardEvent .Builder .class
3029)
3130public final class LeaderboardEvent {
32- private final OffsetDateTime time ;
31+ private final Optional < OffsetDateTime > timestamp ;
3332
3433 private final Optional <Integer > previousRank ;
3534
@@ -41,10 +40,10 @@ public final class LeaderboardEvent {
4140
4241 private final Map <String , Object > additionalProperties ;
4342
44- private LeaderboardEvent (OffsetDateTime time , Optional <Integer > previousRank ,
43+ private LeaderboardEvent (Optional < OffsetDateTime > timestamp , Optional <Integer > previousRank ,
4544 Optional <Integer > rank , Optional <Integer > previousValue , Optional <Integer > value ,
4645 Map <String , Object > additionalProperties ) {
47- this .time = time ;
46+ this .timestamp = timestamp ;
4847 this .previousRank = previousRank ;
4948 this .rank = rank ;
5049 this .previousValue = previousValue ;
@@ -55,9 +54,9 @@ private LeaderboardEvent(OffsetDateTime time, Optional<Integer> previousRank,
5554 /**
5655 * @return The timestamp when the event occurred.
5756 */
58- @ JsonProperty ("time " )
59- public OffsetDateTime getTime () {
60- return time ;
57+ @ JsonProperty ("timestamp " )
58+ public Optional < OffsetDateTime > getTimestamp () {
59+ return timestamp ;
6160 }
6261
6362 /**
@@ -104,173 +103,124 @@ public Map<String, Object> getAdditionalProperties() {
104103 }
105104
106105 private boolean equalTo (LeaderboardEvent other ) {
107- return time .equals (other .time ) && previousRank .equals (other .previousRank ) && rank .equals (other .rank ) && previousValue .equals (other .previousValue ) && value .equals (other .value );
106+ return timestamp .equals (other .timestamp ) && previousRank .equals (other .previousRank ) && rank .equals (other .rank ) && previousValue .equals (other .previousValue ) && value .equals (other .value );
108107 }
109108
110109 @ java .lang .Override
111110 public int hashCode () {
112- return Objects .hash (this .time , this .previousRank , this .rank , this .previousValue , this .value );
111+ return Objects .hash (this .timestamp , this .previousRank , this .rank , this .previousValue , this .value );
113112 }
114113
115114 @ java .lang .Override
116115 public String toString () {
117116 return ObjectMappers .stringify (this );
118117 }
119118
120- public static TimeStage builder () {
119+ public static Builder builder () {
121120 return new Builder ();
122121 }
123122
124- public interface TimeStage {
125- _FinalStage time (@ NotNull OffsetDateTime time );
126-
127- Builder from (LeaderboardEvent other );
128- }
129-
130- public interface _FinalStage {
131- LeaderboardEvent build ();
132-
133- _FinalStage previousRank (Optional <Integer > previousRank );
134-
135- _FinalStage previousRank (Integer previousRank );
136-
137- _FinalStage rank (Optional <Integer > rank );
138-
139- _FinalStage rank (Integer rank );
140-
141- _FinalStage previousValue (Optional <Integer > previousValue );
142-
143- _FinalStage previousValue (Integer previousValue );
144-
145- _FinalStage value (Optional <Integer > value );
146-
147- _FinalStage value (Integer value );
148- }
149-
150123 @ JsonIgnoreProperties (
151124 ignoreUnknown = true
152125 )
153- public static final class Builder implements TimeStage , _FinalStage {
154- private OffsetDateTime time ;
126+ public static final class Builder {
127+ private Optional < OffsetDateTime > timestamp = Optional . empty () ;
155128
156- private Optional <Integer > value = Optional .empty ();
157-
158- private Optional <Integer > previousValue = Optional .empty ();
129+ private Optional <Integer > previousRank = Optional .empty ();
159130
160131 private Optional <Integer > rank = Optional .empty ();
161132
162- private Optional <Integer > previousRank = Optional .empty ();
133+ private Optional <Integer > previousValue = Optional .empty ();
134+
135+ private Optional <Integer > value = Optional .empty ();
163136
164137 @ JsonAnySetter
165138 private Map <String , Object > additionalProperties = new HashMap <>();
166139
167140 private Builder () {
168141 }
169142
170- @ java .lang .Override
171143 public Builder from (LeaderboardEvent other ) {
172- time (other .getTime ());
144+ timestamp (other .getTimestamp ());
173145 previousRank (other .getPreviousRank ());
174146 rank (other .getRank ());
175147 previousValue (other .getPreviousValue ());
176148 value (other .getValue ());
177149 return this ;
178150 }
179151
180- /**
181- * <p>The timestamp when the event occurred.</p>
182- * @return Reference to {@code this} so that method calls can be chained together.
183- */
184- @ java .lang .Override
185- @ JsonSetter ("time" )
186- public _FinalStage time (@ NotNull OffsetDateTime time ) {
187- this .time = Objects .requireNonNull (time , "time must not be null" );
152+ @ JsonSetter (
153+ value = "timestamp" ,
154+ nulls = Nulls .SKIP
155+ )
156+ public Builder timestamp (Optional <OffsetDateTime > timestamp ) {
157+ this .timestamp = timestamp ;
188158 return this ;
189159 }
190160
191- /**
192- * <p>The user's value after this event, or null if they are no longer on the leaderboard.</p>
193- * @return Reference to {@code this} so that method calls can be chained together.
194- */
195- @ java .lang .Override
196- public _FinalStage value (Integer value ) {
197- this .value = Optional .ofNullable (value );
161+ public Builder timestamp (OffsetDateTime timestamp ) {
162+ this .timestamp = Optional .ofNullable (timestamp );
198163 return this ;
199164 }
200165
201- @ java .lang .Override
202166 @ JsonSetter (
203- value = "value " ,
167+ value = "previousRank " ,
204168 nulls = Nulls .SKIP
205169 )
206- public _FinalStage value (Optional <Integer > value ) {
207- this .value = value ;
170+ public Builder previousRank (Optional <Integer > previousRank ) {
171+ this .previousRank = previousRank ;
208172 return this ;
209173 }
210174
211- /**
212- * <p>The user's value before this event, or null if they were not on the leaderboard.</p>
213- * @return Reference to {@code this} so that method calls can be chained together.
214- */
215- @ java .lang .Override
216- public _FinalStage previousValue (Integer previousValue ) {
217- this .previousValue = Optional .ofNullable (previousValue );
175+ public Builder previousRank (Integer previousRank ) {
176+ this .previousRank = Optional .ofNullable (previousRank );
218177 return this ;
219178 }
220179
221- @ java .lang .Override
222180 @ JsonSetter (
223- value = "previousValue " ,
181+ value = "rank " ,
224182 nulls = Nulls .SKIP
225183 )
226- public _FinalStage previousValue (Optional <Integer > previousValue ) {
227- this .previousValue = previousValue ;
184+ public Builder rank (Optional <Integer > rank ) {
185+ this .rank = rank ;
228186 return this ;
229187 }
230188
231- /**
232- * <p>The user's rank after this event, or null if they are no longer on the leaderboard.</p>
233- * @return Reference to {@code this} so that method calls can be chained together.
234- */
235- @ java .lang .Override
236- public _FinalStage rank (Integer rank ) {
189+ public Builder rank (Integer rank ) {
237190 this .rank = Optional .ofNullable (rank );
238191 return this ;
239192 }
240193
241- @ java .lang .Override
242194 @ JsonSetter (
243- value = "rank " ,
195+ value = "previousValue " ,
244196 nulls = Nulls .SKIP
245197 )
246- public _FinalStage rank (Optional <Integer > rank ) {
247- this .rank = rank ;
198+ public Builder previousValue (Optional <Integer > previousValue ) {
199+ this .previousValue = previousValue ;
248200 return this ;
249201 }
250202
251- /**
252- * <p>The user's rank before this event, or null if they were not on the leaderboard.</p>
253- * @return Reference to {@code this} so that method calls can be chained together.
254- */
255- @ java .lang .Override
256- public _FinalStage previousRank (Integer previousRank ) {
257- this .previousRank = Optional .ofNullable (previousRank );
203+ public Builder previousValue (Integer previousValue ) {
204+ this .previousValue = Optional .ofNullable (previousValue );
258205 return this ;
259206 }
260207
261- @ java .lang .Override
262208 @ JsonSetter (
263- value = "previousRank " ,
209+ value = "value " ,
264210 nulls = Nulls .SKIP
265211 )
266- public _FinalStage previousRank (Optional <Integer > previousRank ) {
267- this .previousRank = previousRank ;
212+ public Builder value (Optional <Integer > value ) {
213+ this .value = value ;
214+ return this ;
215+ }
216+
217+ public Builder value (Integer value ) {
218+ this .value = Optional .ofNullable (value );
268219 return this ;
269220 }
270221
271- @ java .lang .Override
272222 public LeaderboardEvent build () {
273- return new LeaderboardEvent (time , previousRank , rank , previousValue , value , additionalProperties );
223+ return new LeaderboardEvent (timestamp , previousRank , rank , previousValue , value , additionalProperties );
274224 }
275225 }
276226}
0 commit comments