Class AbstractScoreJacksonJsonSerializer<Score_ extends Score<Score_>>
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<Score_>
-
- org.optaplanner.persistence.jackson.api.score.AbstractScoreJacksonJsonSerializer<Score_>
-
- Type Parameters:
Score_
- the actual score type
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.ser.ContextualSerializer
- Direct Known Subclasses:
BendableBigDecimalScoreJacksonJsonSerializer
,BendableLongScoreJacksonJsonSerializer
,BendableScoreJacksonJsonSerializer
,HardMediumSoftBigDecimalScoreJacksonJsonSerializer
,HardMediumSoftLongScoreJacksonJsonSerializer
,HardMediumSoftScoreJacksonJsonSerializer
,HardSoftBigDecimalScoreJacksonJsonSerializer
,HardSoftDoubleScoreJacksonJsonSerializer
,HardSoftLongScoreJacksonJsonSerializer
,HardSoftScoreJacksonJsonSerializer
,SimpleBigDecimalScoreJacksonJsonSerializer
,SimpleDoubleScoreJacksonJsonSerializer
,SimpleLongScoreJacksonJsonSerializer
,SimpleScoreJacksonJsonSerializer
public abstract class AbstractScoreJacksonJsonSerializer<Score_ extends Score<Score_>> extends com.fasterxml.jackson.databind.JsonSerializer<Score_> implements com.fasterxml.jackson.databind.ser.ContextualSerializer
Jackson binding support for aScore
subtype. For aScore
field, usePolymorphicScoreJacksonJsonSerializer
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 aHardSoftScore score
field and it will marshalled to JSON as"score":"-999hard/-999soft"
. Or better yet, useOptaPlannerJacksonModule
instead.- See Also:
Score
-
-
Constructor Summary
Constructors Constructor Description AbstractScoreJacksonJsonSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Method Detail
-
createContextual
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
- Specified by:
createContextual
in interfacecom.fasterxml.jackson.databind.ser.ContextualSerializer
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
serialize
public void serialize(Score_ score, com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException
- Specified by:
serialize
in classcom.fasterxml.jackson.databind.JsonSerializer<Score_ extends Score<Score_>>
- Throws:
IOException
-
-