public class PolymorphicScoreJacksonJsonSerializer extends com.fasterxml.jackson.databind.JsonSerializer<Score>
Score
type (but not a subtype).
For a Score
subtype field, use HardSoftScoreJacksonJsonSerializer
or similar instead.
For example: use @JsonSerialize(using = PolymorphicScoreJacksonJsonSerializer.class) @JsonDeserialize(using = PolymorphicScoreJacksonJsonDeserializer.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"}
.
Score
,
PolymorphicScoreJacksonJsonDeserializer
Constructor and Description |
---|
PolymorphicScoreJacksonJsonSerializer() |
Modifier and Type | Method and Description |
---|---|
void |
serialize(Score score,
com.fasterxml.jackson.core.JsonGenerator generator,
com.fasterxml.jackson.databind.SerializerProvider serializers) |
public PolymorphicScoreJacksonJsonSerializer()
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>
IOException
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.