Class ObjectMapperUtil

java.lang.Object
com.skava.orchestration.utils.ObjectMapperUtil

public final class ObjectMapperUtil extends Object

The Class ObjectMapperUtil

This is object mapper utility class. Used to convert objects
Author:
Infosys Equinox
  • 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

      public static <T> T convertToObject(String json, Class<T> clazz) throws IOException
      Model conversion
      Type Parameters:
      T - Request object
      Parameters:
      json - String json input which needs to be converted to object
      clazz - input class
      Returns:
      Response object
      Throws:
      IOException - exception occurs when model conversion failed
    • convertToObjectWithOutException

      public static <T> T convertToObjectWithOutException(String json, Class<T> clazz)
      Model conversion
      Type Parameters:
      T - Request object
      Parameters:
      json - String json input which needs to be converted to object
      clazz - input class
      Returns:
      Response object
    • convertToListOfObjectWithOutException

      public static <T> List<T> convertToListOfObjectWithOutException(String json, Class<T> clazz)
      List of object conversion
      Type Parameters:
      T - Request object
      Parameters:
      json - String json input which needs to be converted to object
      clazz - input class
      Returns:
      Response object
    • convertObjectToString

      public static <T> String convertObjectToString(T object)
      Convert object to string.
      Type Parameters:
      T - the generic type
      Parameters:
      object - the object
      Returns:
      the string
    • getModelMapper

      public static <T> T getModelMapper(Class<T> clazz)
      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