Package com.jummania
Interface DataManager.Converter
- All Known Implementing Classes:
GsonConverter
- Enclosing interface:
- DataManager
public static interface DataManager.Converter
-
Method Summary
Modifier and TypeMethodDescription<T> T
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
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
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 convertedtypeOfT
- the type of the object to be returned- Returns:
- the Java object represented by the JSON string
-
fromReader
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 convertedtypeOfT
- the type of the object to be returned- Returns:
- the Java object represented by the JSON data from the Reader
-