fix: code cleanup
This commit is contained in:
parent
b00ba50f97
commit
0bb4ba21df
@ -24,7 +24,7 @@ public class EntityDeserializer extends JsonDeserializer<Entity> {
|
|||||||
private final ObjectMapper mapper = new ObjectMapper();
|
private final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Entity deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
public Entity deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
ObjectCodec codec = p.getCodec();
|
ObjectCodec codec = p.getCodec();
|
||||||
JsonNode node = codec.readTree(p);
|
JsonNode node = codec.readTree(p);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class EntityIDDeserializer extends JsonDeserializer<EntityID> {
|
public class EntityIDDeserializer extends JsonDeserializer<EntityID> {
|
||||||
@Override
|
@Override
|
||||||
public EntityID deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
public EntityID deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
ObjectCodec codec = p.getCodec();
|
ObjectCodec codec = p.getCodec();
|
||||||
JsonNode node = codec.readTree(p);
|
JsonNode node = codec.readTree(p);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class EventDeserializer extends JsonDeserializer<Event> {
|
|||||||
private final ObjectMapper mapper = new ObjectMapper();
|
private final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Event deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
public Event deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
ObjectCodec codec = p.getCodec();
|
ObjectCodec codec = p.getCodec();
|
||||||
JsonNode node = codec.readTree(p);
|
JsonNode node = codec.readTree(p);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class IntVector2Deserializer extends JsonDeserializer<IntVector2> {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IntVector2 deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
public IntVector2 deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
var values = mapper.readValue(p, Integer[].class);
|
var values = mapper.readValue(p, Integer[].class);
|
||||||
IntVector2 result = new IntVector2(values[0], values[1]);
|
IntVector2 result = new IntVector2(values[0], values[1]);
|
||||||
return result;
|
return result;
|
||||||
|
@ -96,7 +96,7 @@ class EntityDeserializerTest {
|
|||||||
"position": [12357, 1371113]
|
"position": [12357, 1371113]
|
||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
assertThat((Rock) mapper.readValue(jsonRepresentingRock, Rock.class))
|
assertThat(mapper.readValue(jsonRepresentingRock, Rock.class))
|
||||||
.isEqualTo(rock);
|
.isEqualTo(rock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,4 +258,4 @@ class EntityDeserializerTest {
|
|||||||
characterName.setLength(0); // empty the StringBuilder
|
characterName.setLength(0); // empty the StringBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user