org.optaplanner.persistence.jackson.api.score

## Class PolymorphicScoreJacksonJsonSerializer

- java.lang.Object
- - com.fasterxml.jackson.databind.JsonSerializer<Score>
  - - org.optaplanner.persistence.jackson.api.score.PolymorphicScoreJacksonJsonSerializer

- All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable

      public class PolymorphicScoreJacksonJsonSerializer
      extends com.fasterxml.jackson.databind.JsonSerializer<Score>

  Jackson binding support for a `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"}`.

  See Also:
    `Score`, `PolymorphicScoreJacksonJsonDeserializer`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

      `com.fasterxml.jackson.databind.JsonSerializer.None`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PolymorphicScoreJacksonJsonSerializer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `serialize(Score score, com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider serializers)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

      `acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PolymorphicScoreJacksonJsonSerializer

          public PolymorphicScoreJacksonJsonSerializer()

  - ### 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 class `com.fasterxml.jackson.databind.JsonSerializer<Score>`
      Throws:
        `IOException`

Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.