Class PolymorphicScoreJacksonSerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<Score>
-
- org.optaplanner.persistence.jackson.api.score.PolymorphicScoreJacksonSerializer
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
public class PolymorphicScoreJacksonSerializer extends com.fasterxml.jackson.databind.JsonSerializer<Score>
Jackson binding support for aScore
type (but not a subtype). For aScore
subtype field, useHardSoftScoreJacksonSerializer
or similar instead.For example: use
@JsonSerialize(using = PolymorphicScoreJacksonSerializer.class) @JsonDeserialize(using = PolymorphicScoreJacksonDeserializer.class)
on aScore score
field which contains aHardSoftScore
instance and it will marshalled to JSON as"score":{"type":"HARD_SOFT",score:"-999hard/-999soft"}
.- See Also:
Score
,PolymorphicScoreJacksonDeserializer
-
-
Constructor Summary
Constructors Constructor Description PolymorphicScoreJacksonSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
serialize(Score score, com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider serializers)
-
-
-
Method Detail
-
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>
- Throws:
IOException
-
-