public class BeanUtil extends Object
Constructor and Description |
---|
BeanUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
JSONToObject(InputStream is,
Class<T> classname)
Converts a JSON inputstream to an actual object.
|
static <T> T |
JSONToObject(String json,
Class<T> classname)
Converts a JSON string to an actual object.
|
static String |
objectToJSON(Object object)
Convert the object to JSON.
|
static <T> T |
removeDuplicate(T obj)
Check the object for any objects that have same ID but are different
instance.
|
public static <T> T JSONToObject(String json, Class<T> classname) throws IOException
json
- the json encoded object.classname
- the classname to which the json object should be converted.IOException
- throws an IOException if the string could not be converted to
an actual object.public static String objectToJSON(Object object) throws IOException
object
- the object to be convertedIOException
- throws an IOException if the object could not be converted.public static <T> T JSONToObject(InputStream is, Class<T> classname) throws IOException
is
- the inputstream with the json code.classname
- the classname to which the json object should be converted.IOException
- throws an IOException if the string could not be converted to
an actual object.public static <T> T removeDuplicate(T obj)
obj
- the object to be checked for duplicates.Copyright © 2017. All rights reserved.