Package com.skava.orchestration.utils
Class ObjectMapperUtil
java.lang.Object
com.skava.orchestration.utils.ObjectMapperUtil
The Class ObjectMapperUtil
This is object mapper utility class. Used to convert objects- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> StringconvertObjectToString(T object) Convert object to string.static <T> List<T>convertToListOfObjectWithOutException(String json, Class<T> clazz) List of object conversionstatic <T> TconvertToObject(String json, Class<T> clazz) Model conversionstatic <T> TconvertToObjectWithOutException(String json, Class<T> clazz) Model conversionstatic com.fasterxml.jackson.databind.ObjectMapperThis is utility singleton class and hence to access the global instance introduced the getInstance.static <T> TgetModelMapper(Class<T> clazz) This method is used to get object model mapper for the dynamic object.
-
Method Details
-
getInstance
public static com.fasterxml.jackson.databind.ObjectMapper getInstance()This is utility singleton class and hence to access the global instance introduced the getInstance.- Returns:
- the mapper Instance
-
convertToObject
Model conversion- Type Parameters:
T- Request object- Parameters:
json- String json input which needs to be converted to objectclazz- input class- Returns:
- Response object
- Throws:
IOException- exception occurs when model conversion failed
-
convertToObjectWithOutException
Model conversion- Type Parameters:
T- Request object- Parameters:
json- String json input which needs to be converted to objectclazz- input class- Returns:
- Response object
-
convertToListOfObjectWithOutException
List of object conversion- Type Parameters:
T- Request object- Parameters:
json- String json input which needs to be converted to objectclazz- input class- Returns:
- Response object
-
convertObjectToString
Convert object to string.- Type Parameters:
T- the generic type- Parameters:
object- the object- Returns:
- the string
-
getModelMapper
This method is used to get object model mapper for the dynamic object.- Type Parameters:
T- the generic type- dynamic object- Parameters:
clazz- Class for which the model mapper needs to retrieved- Returns:
- the generic type- dynamic object
-