Package com.jummania

Interface DataManager.Converter

All Known Implementing Classes:
GsonConverter
Enclosing interface:
DataManager

public static interface DataManager.Converter
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    fromJson (String json, Type typeOfT)
    Converts a JSON string into a Java object of the specified type.
    <T> T
    fromReader (Reader json, Type typeOfT)
    Converts a JSON stream from a Reader into a Java object of the specified type.
    <T> String
    toJson (T data)
    Converts a Java object to its JSON representation.
  • Method Details

    • toJson

      <T> String toJson (T data)
      Converts a Java object to its JSON representation.
      Type Parameters:
      T - the type of the object
      Parameters:
      data - the Java object to be converted to JSON
      Returns:
      a JSON string representing the object
    • fromJson

      <T> T fromJson (String json, Type typeOfT)
      Converts a JSON string into a Java object of the specified type.
      Type Parameters:
      T - the type of the object
      Parameters:
      json - the JSON string to be converted
      typeOfT - the type of the object to be returned
      Returns:
      the Java object represented by the JSON string
    • fromReader

      <T> T fromReader (Reader json, Type typeOfT)
      Converts a JSON stream from a Reader into a Java object of the specified type.
      Type Parameters:
      T - the type of the object
      Parameters:
      json - the Reader containing the JSON data to be converted
      typeOfT - the type of the object to be returned
      Returns:
      the Java object represented by the JSON data from the Reader