public class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
fromJson(String json,
Class<T> klass)
Convert the given JSON string into an object using
Gson.
|
static String |
join(String[] strings,
String delimiter)
Concatenate string with the specified delimiter.
|
static String |
toJson(Object object)
Convert the given object into a JSON string using
Gson.
|
static String |
toJson(Object object,
boolean pretty)
Convert the given object into a JSON string using
Gson.
|
public static String join(String[] strings, String delimiter)
strings - Strings to be concatenated.delimiter - A delimiter used between strings. If null or an empty
string is given, delimiters are not inserted between strings.strings is null,
null is returned. If the size of strings is 0,
an empty string is returned.public static String toJson(Object object)
object - The input object.object is null,
null is returned.public static String toJson(Object object, boolean pretty)
object - The input object.pretty - True for human-readable format.object is null,
null is returned.Copyright © 2017. All rights reserved.