Class 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:
    Serialized Form
    • 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
      MessageKeySerializer()
      Create an instance of the custom serializer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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
    • Field Detail

      • SERIALIZATION_ATTRIBUTE_HTTP_REQUEST

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

      • MessageKeySerializer

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

      • 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