Class HankoJsonParser

java.lang.Object
io.hanko.sdk.json.HankoJsonParser

public class HankoJsonParser extends Object
Custom Json parser used for serializing Hanko API payloads and deserializing Hanko API responses.
  • Constructor Details

    • HankoJsonParser

      public HankoJsonParser()
      Construct a HankoJsonParser.
  • Method Details

    • deserialize

      public <T> T deserialize(InputStream is, Class<T> valueType)
      Deserialize InputStream is into object of type T.
      Type Parameters:
      T - the type to deserialize data into
      Parameters:
      is - the InputStream
      valueType - the Class for type T
      Returns:
      an instance of T
      Throws:
      HankoClientException - if any error during deserialization occurs
    • deserialize

      public <T> T deserialize(String s, Class<T> valueType)
      Deserialize String s into object of type T.
      Type Parameters:
      T - the type to deserialize data into
      Parameters:
      s - the String
      valueType - the Class for type T
      Returns:
      an instance of T
      Throws:
      HankoClientException - if any error during deserialization occurs
    • deserialize

      public <T> T deserialize(File f, Class<T> valueType)
      Deserialize File f into object of type T.
      Type Parameters:
      T - the type to deserialize data into
      Parameters:
      f - the File
      valueType - the Class for type T
      Returns:
      an instance of T
      Throws:
      HankoClientException - if any error during deserialization occurs
    • deserializeList

      public <T> List<T> deserializeList(InputStream is, Class<T> valueType)
      Deserialize InputStream is into a list of objects of type T.
      Type Parameters:
      T - the type to deserialize data into
      Parameters:
      is - the InputStream
      valueType - the Class for type T
      Returns:
      an instance of T
      Throws:
      HankoClientException - if any error during deserialization occurs
    • serialize

      public <T> String serialize(T value)
      Serialize instance of type T to a String.
      Type Parameters:
      T - the type to serialize
      Parameters:
      value - an instance of type T
      Returns:
      the serialized String
      Throws:
      HankoClientException - if any error during serialization occurs