22 lines
654 B
Java
22 lines
654 B
Java
package io.gitlab.jfronny.muscript.gson.impl.typed;
|
|
|
|
import io.gitlab.jfronny.gson.TypeAdapter;
|
|
import io.gitlab.jfronny.gson.stream.JsonReader;
|
|
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
|
import io.gitlab.jfronny.muscript.data.dynamic.DBool;
|
|
import io.gitlab.jfronny.muscript.data.dynamic.additional.DFinal;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class DBoolSerializer extends TypeAdapter<DBool> {
|
|
@Override
|
|
public void write(JsonWriter w, DBool dynamic) throws IOException {
|
|
w.value(dynamic.getValue());
|
|
}
|
|
|
|
@Override
|
|
public DBool read(JsonReader r) throws IOException {
|
|
return DFinal.of(r.nextBoolean());
|
|
}
|
|
}
|