Score_
- the actual score typepublic abstract class AbstractScoreJacksonJsonSerializer<Score_ extends Score<Score_>>
extends com.fasterxml.jackson.databind.JsonSerializer<Score_>
implements com.fasterxml.jackson.databind.ser.ContextualSerializer
Score
subtype.
For a Score
field, use PolymorphicScoreJacksonJsonSerializer
instead,
so the score type is recorded too and it can be deserialized.
For example: use @JsonSerialize(using = HardSoftScoreJacksonJsonSerializer.class) @JsonDeserialize(using = HardSoftScoreJacksonJsonDeserializer.class)
on a HardSoftScore score
field and it will marshalled to JSON as "score":"-999hard/-999soft"
.
Or better yet, use OptaPlannerJacksonModule
instead.
Score
Constructor and Description |
---|
AbstractScoreJacksonJsonSerializer() |
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.JsonSerializer<?> |
createContextual(com.fasterxml.jackson.databind.SerializerProvider provider,
com.fasterxml.jackson.databind.BeanProperty property) |
void |
serialize(Score_ score,
com.fasterxml.jackson.core.JsonGenerator generator,
com.fasterxml.jackson.databind.SerializerProvider serializers) |
public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.BeanProperty property) throws com.fasterxml.jackson.databind.JsonMappingException
createContextual
in interface com.fasterxml.jackson.databind.ser.ContextualSerializer
com.fasterxml.jackson.databind.JsonMappingException
public void serialize(Score_ score, com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException
serialize
in class com.fasterxml.jackson.databind.JsonSerializer<Score_ extends Score<Score_>>
IOException
Copyright © 2006–2018 JBoss by Red Hat. All rights reserved.