Class MessageKeySerializer

java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdSerializer<String>
com.pingidentity.sdk.api.authn.util.MessageKeySerializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable, com.fasterxml.jackson.databind.jsonschema.SchemaAware, Serializable

public class MessageKeySerializer extends com.fasterxml.jackson.databind.ser.std.StdSerializer<String>
A Jackson custom serializer that converts a String field that may contain a message key from authn-api-messages.properties or pingfederate-messages.properties into a localized string. If the key is not found in either properties file then the field value is directly serialized to JSON. This serializer can be attached to a model field using the @JsonSerialize annotation.
Since:
9.3
See Also:
  • Nested Class Summary

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

    com.fasterxml.jackson.databind.JsonSerializer.None
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A JSON serialization context attribute containing the current HTTP request.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an instance of the custom serializer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    serialize(String messageKey, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
    The custom serialization implementation.

    Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

    acceptJsonFormatVisitor, getSchema, getSchema, handledType, wrapAndThrow, wrapAndThrow

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

    getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SERIALIZATION_ATTRIBUTE_HTTP_REQUEST

      public static final String SERIALIZATION_ATTRIBUTE_HTTP_REQUEST
      A JSON serialization context attribute containing the current HTTP request.
      See Also:
  • Constructor Details

    • MessageKeySerializer

      public MessageKeySerializer()
      Create an instance of the custom serializer.
  • Method Details

    • serialize

      public void serialize(String messageKey, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      The custom serialization implementation.
      Specified by:
      serialize in class com.fasterxml.jackson.databind.ser.std.StdSerializer<String>
      Parameters:
      messageKey - The value of the field to be serialized.
      jsonGenerator - JSON generator provided by Jackson.
      serializerProvider - SerializerProvider provided by Jackson.
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException