RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.OptionalIntAdapter Class Reference
Inheritance diagram for com.runehive.util.OptionalIntAdapter:
Collaboration diagram for com.runehive.util.OptionalIntAdapter:

Public Member Functions

OptionalInt read (JsonReader in) throws IOException
void write (JsonWriter out, OptionalInt value) throws IOException

Detailed Description

Definition at line 11 of file OptionalIntAdapter.java.

Member Function Documentation

◆ read()

OptionalInt com.runehive.util.OptionalIntAdapter.read ( JsonReader in) throws IOException

Definition at line 23 of file OptionalIntAdapter.java.

23 {
24 if (in.peek() == JsonToken.NULL) {
25 in.nextNull();
26 return OptionalInt.empty();
27 } else {
28 return OptionalInt.of(in.nextInt());
29 }
30 }

◆ write()

void com.runehive.util.OptionalIntAdapter.write ( JsonWriter out,
OptionalInt value ) throws IOException

Definition at line 14 of file OptionalIntAdapter.java.

14 {
15 if (value.isPresent()) {
16 out.value(value.getAsInt());
17 } else {
18 out.nullValue();
19 }
20 }

The documentation for this class was generated from the following file: