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 a
Score type (but not a subtype).
For a Score subtype field, use HardSoftScoreJacksonSerializer or similar instead.
For example: use
@JsonSerialize(using = PolymorphicScoreJacksonSerializer.class) @JsonDeserialize(using = PolymorphicScoreJacksonDeserializer.class)
on a Score score field which contains a HardSoftScore instance
and it will marshalled to JSON as "score":{"type":"HARD_SOFT",score:"-999hard/-999soft"}.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
-
Constructor Details
-
PolymorphicScoreJacksonSerializer
public PolymorphicScoreJacksonSerializer()
-
-
Method Details
-
serialize
public void serialize(Score score, com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException - Specified by:
serializein classcom.fasterxml.jackson.databind.JsonSerializer<Score>- Throws:
IOException
-