23 lines
523 B
Java
23 lines
523 B
Java
package ctbrec.io;
|
|
|
|
import java.io.IOException;
|
|
import java.util.UUID;
|
|
|
|
import com.squareup.moshi.JsonAdapter;
|
|
import com.squareup.moshi.JsonReader;
|
|
import com.squareup.moshi.JsonWriter;
|
|
|
|
public class UuidJSonAdapter extends JsonAdapter<UUID> {
|
|
|
|
@Override
|
|
public UUID fromJson(JsonReader reader) throws IOException {
|
|
return UUID.fromString(reader.nextString());
|
|
}
|
|
|
|
@Override
|
|
public void toJson(JsonWriter writer, UUID value) throws IOException {
|
|
writer.value(value.toString());
|
|
}
|
|
|
|
}
|