Class UpbitArrayOrMessageDeserializer<T,​C>

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<C>
org.knowm.xchange.upbit.service.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
  • Constructor Summary

    Constructors
    Constructor Description
    UpbitArrayOrMessageDeserializer​(Class<T> classT, Class<C> classC)  
    UpbitArrayOrMessageDeserializer​(Class<T> classT, Class<C> classC, boolean collectionHasMessageFlag)  
  • Method Summary

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

    • UpbitArrayOrMessageDeserializer

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

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

    • 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