feat: changed ObjectMapper to static for the JSON deserializers

This commit is contained in:
Yannik Bretschneider 2021-05-26 16:16:48 +02:00
parent 65c33d886c
commit 7dcffab0a6
3 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,8 @@ public class EntityDeserializer extends JsonDeserializer<Entity> {
Rock
}
private final ObjectMapper mapper = new ObjectMapper();
// static so that no reinitializations are needed
private static final ObjectMapper mapper = new ObjectMapper();
@Override
public Entity deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {

View File

@ -22,7 +22,8 @@ import java.util.HashMap;
public class EventDeserializer extends JsonDeserializer<Event> {
private final ObjectMapper mapper = new ObjectMapper();
// static so that no reinitializations are needed
private static final ObjectMapper mapper = new ObjectMapper();
@Override
public Event deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {

View File

@ -13,7 +13,8 @@ import java.io.IOException;
public class IntVector2Deserializer extends JsonDeserializer<IntVector2> {
ObjectMapper mapper = new ObjectMapper();
// static so that no reinitializations are needed
private static final ObjectMapper mapper = new ObjectMapper();
@Override
public IntVector2 deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {