Class JsonUtil
- java.lang.Object
-
- hu.icellmobilsoft.coffee.tool.gson.JsonUtil
-
public class JsonUtil extends Object
Json util.- Since:
- 1.0.0
- Author:
- imre.scheffer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringtoJson(Object dto)Converting DTO object to JSON string without throwing exceptionstatic StringtoJsonEx(Object dto)Converting DTO object to JSON stringstatic StringtoJsonGson(Object dto)Converting DTO object to JSON stringstatic <T> TtoObject(String json, Class<T> classType)Converting JSON string to DTO object without throwing exceptionstatic <T> TtoObjectEx(String json, Class<T> classType)Converting JSON string to DTO objectstatic <T> TtoObjectGson(Reader reader, Class<T> classType)Convert JSON String to DTO object without throwing exceptionstatic <T> TtoObjectGson(String json, Class<T> classType)Convert JSON String to DTO object without throwing exceptionstatic <T> TtoObjectUnchecked(String json, Type typeOfT)Converting JSON string to DTO object without throwing exceptionstatic <T> TtoObjectUncheckedEx(String json, Type typeOfT)Converting JSON string to DTO objectstatic <T> TtoObjectUncheckedGson(Reader reader, Type typeOfT)Convert JSON String to DTO object without throwing exceptionstatic <T> TtoObjectUncheckedGson(String json, Type typeOfT)Convert JSON String to DTO object without throwing exception
-
-
-
Method Detail
-
toObjectUncheckedEx
public static <T> T toObjectUncheckedEx(String json, Type typeOfT) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Converting JSON string to DTO object- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringtypeOfT- type of returned object- Returns:
- object
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- exception
-
toObjectUncheckedGson
public static <T> T toObjectUncheckedGson(String json, Type typeOfT)
Convert JSON String to DTO object without throwing exception- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringtypeOfT- type of returned object- Returns:
- DTO
-
toObjectUncheckedGson
public static <T> T toObjectUncheckedGson(Reader reader, Type typeOfT)
Convert JSON String to DTO object without throwing exception- Type Parameters:
T- type of returned object- Parameters:
reader- JSON readertypeOfT- type of returned object- Returns:
- DTO
-
toJson
public static String toJson(Object dto)
Converting DTO object to JSON string without throwing exception- Parameters:
dto- DTO object- Returns:
- JSON String
-
toObject
public static <T> T toObject(String json, Class<T> classType)
Converting JSON string to DTO object without throwing exception- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringclassType- class of returned object- Returns:
- object
-
toObjectUnchecked
public static <T> T toObjectUnchecked(String json, Type typeOfT)
Converting JSON string to DTO object without throwing exception- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringtypeOfT- type of returned object- Returns:
- object
-
toJsonEx
public static String toJsonEx(Object dto) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Converting DTO object to JSON string- Parameters:
dto- DTO object- Returns:
- JSON String
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- exception
-
toObjectEx
public static <T> T toObjectEx(String json, Class<T> classType) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Converting JSON string to DTO object- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringclassType- class of returned object- Returns:
- object
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- exception
-
toJsonGson
public static String toJsonGson(Object dto)
Converting DTO object to JSON string- Parameters:
dto- DTO object- Returns:
- JSON String
-
toObjectGson
public static <T> T toObjectGson(String json, Class<T> classType)
Convert JSON String to DTO object without throwing exception- Type Parameters:
T- type of returned object- Parameters:
json- JSON StringclassType- class of returned object- Returns:
- DTO
-
-