Class UpbitArrayOrMessageDeserializer<T,​C>

  • Type Parameters:
    T - The individual array element type.
    C - The container type that contains an array of T.
    All Implemented Interfaces:
    com.fasterxml.jackson.databind.deser.NullValueProvider

    public abstract class UpbitArrayOrMessageDeserializer<T,​C>
    extends com.fasterxml.jackson.databind.JsonDeserializer<C>
    For several of the Upbit APIs a JSON array is returned. If there is an error however, the json is a json object not an array. To handle this case we have this generic JsonDeserializer that can handle an array or a json object being returned.

    Assumptions

    • The type T represents a POJO that includes a message field to handle the error case.
    • The type C supplies a constructor that accepts and array of type T.
    Author:
    bryant_harris
    • Nested Class Summary

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      C deserialize​(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext ctx)  
      • Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer

        deserialize, deserializeWithType, deserializeWithType, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, replaceDelegatee, supportsUpdate, unwrappingDeserializer
    • Constructor Detail

      • UpbitArrayOrMessageDeserializer

        public UpbitArrayOrMessageDeserializer​(Class<T> classT,
                                               Class<C> classC,
                                               boolean collectionHasMessageFlag)
      • UpbitArrayOrMessageDeserializer

        public UpbitArrayOrMessageDeserializer​(Class<T> classT,
                                               Class<C> classC)
    • Method Detail

      • deserialize

        public C deserialize​(com.fasterxml.jackson.core.JsonParser jsonParser,
                             com.fasterxml.jackson.databind.DeserializationContext ctx)
                      throws IOException,
                             com.fasterxml.jackson.core.JsonProcessingException
        Specified by:
        deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<C>
        Throws:
        IOException
        com.fasterxml.jackson.core.JsonProcessingException