Class ErrorResponseDeserializer

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<ErrorResponse>
io.mailtrap.serialization.ErrorResponseDeserializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider

public class ErrorResponseDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<ErrorResponse>
Custom deserializer for ErrorResponse that handles the deserialization of error messages from a variety of possible JSON structures.

This deserializer can handle different formats of error representations in JSON:

  • An array of error messages under the "errors" field.
  • A single textual error message under the "errors" or "error" field.
  • An object containing nested fields with error messages under the "errors" field.

The deserializer collects all error messages into a list and constructs an ErrorResponse object that encapsulates these messages.

  • Nested Class Summary

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

    com.fasterxml.jackson.databind.JsonDeserializer.None
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
     

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

    deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ErrorResponseDeserializer

      public ErrorResponseDeserializer()
  • Method Details

    • deserialize

      public ErrorResponse deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext deserializationContext) throws IOException
      Specified by:
      deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<ErrorResponse>
      Throws:
      IOException