feat: optimized IntVector2Deserializer
This commit is contained in:
parent
d0829f3948
commit
cb0f2cae13
@ -12,13 +12,9 @@ import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntVector2Deserializer extends JsonDeserializer<IntVector2> {
|
||||
|
||||
// static so that no reinitializations are needed
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public IntVector2 deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
var values = mapper.readValue(p, Integer[].class);
|
||||
var values = p.readValueAs(Integer[].class);
|
||||
IntVector2 result = new IntVector2(values[0], values[1]);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user