Package org.optaplanner.persistence.jackson.api.score

## Class AbstractScoreJacksonSerializer<Score_ extends Score<Score_>>

- java.lang.Object
- - com.fasterxml.jackson.databind.JsonSerializer<Score_>
  - - org.optaplanner.persistence.jackson.api.score.AbstractScoreJacksonSerializer<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:
    `BendableBigDecimalScoreJacksonSerializer`, `BendableLongScoreJacksonSerializer`, `BendableScoreJacksonSerializer`, `HardMediumSoftBigDecimalScoreJacksonSerializer`, `HardMediumSoftLongScoreJacksonSerializer`, `HardMediumSoftScoreJsonSerializer`, `HardSoftBigDecimalScoreJacksonSerializer`, `HardSoftLongScoreJacksonSerializer`, `HardSoftScoreJacksonSerializer`, `SimpleBigDecimalScoreJacksonSerializer`, `SimpleLongScoreJacksonSerializer`, `SimpleScoreJacksonSerializer`

      public abstract class AbstractScoreJacksonSerializer<Score_ extends Score<Score_>>
      extends com.fasterxml.jackson.databind.JsonSerializer<Score_>
      implements com.fasterxml.jackson.databind.ser.ContextualSerializer

  Jackson binding support for a `Score` subtype. For a `Score` field, use `PolymorphicScoreJacksonSerializer` instead, so the score type is recorded too and it can be deserialized.

  For example: use `@JsonSerialize(using = HardSoftScoreJacksonSerializer.class) @JsonDeserialize(using = HardSoftScoreJacksonDeserializer.class)` on a `HardSoftScore score` field and it will marshalled to JSON as `"score":"-999hard/-999soft"`. Or better yet, use `OptaPlannerJacksonModule` instead.

  See Also:
    `Score`

- - ### Nested Class Summary

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

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractScoreJacksonSerializer()` |

  - ### 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)` |

    - ### 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

    - #### AbstractScoreJacksonSerializer

          public AbstractScoreJacksonSerializer()

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