Class MapperUtil

java.lang.Object
com.skava.oms.util.MapperUtil

public final class MapperUtil extends Object
This class contains common utility functions which are using order process. It's contains only static functions.
Author:
Infosys Equinox
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.fasterxml.jackson.databind.ObjectMapper
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> com.skava.core.event.Message<T>
    castFromTypeRef(byte[] bs)
    Method to convert the given bytes into Message using typeReference
    static <T> T
    castTypeFromBytes(byte[] content, Class<T> requiredType)
    Method to convert the given Bytes content to required class
    static <T> T
    castTypeFromJsonNode(com.fasterxml.jackson.databind.JsonNode content, Class<T> requiredType)
    Method to convert the given JsonNode content to required class
    static <T> T
    castTypeFromObj(Object content, Class<T> requiredType)
    Method to convert the given JsonNode content to required class
    static <T> T
    castTypeFromString(String content, Class<T> requiredType)
    Method to convert the given JsonNode content to required class
    static com.fasterxml.jackson.databind.JsonNode
    Method to get the jsonNode for given object
    static String
    Method to get the writer for the given content
    static <T> com.fasterxml.jackson.databind.ObjectReader
    getReader(Class<T> requiredType)
    Method to get the reader object for the given type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • objectMapper

      public static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
  • Method Details

    • getReader

      public static <T> com.fasterxml.jackson.databind.ObjectReader getReader(Class<T> requiredType)
      Method to get the reader object for the given type
      Type Parameters:
      T - - any type of class
      Parameters:
      requiredType - - new reader instance that is configured to data bind into specified type.
      Returns:
      newly configured instance.
    • getJsonFromObject

      public static String getJsonFromObject(Object content)
      Method to get the writer for the given content
      Parameters:
      content - - write object
      Returns:
      string
    • castFromTypeRef

      public static <T> com.skava.core.event.Message<T> castFromTypeRef(byte[] bs)
      Method to convert the given bytes into Message using typeReference
      Type Parameters:
      T - - Type reference
      Parameters:
      bs - - byte value
      Returns:
      message
    • castTypeToJsonNode

      public static com.fasterxml.jackson.databind.JsonNode castTypeToJsonNode(Object content)
      Method to get the jsonNode for given object
      Parameters:
      content - - message content
      Returns:
      - json node
    • castTypeFromJsonNode

      public static <T> T castTypeFromJsonNode(com.fasterxml.jackson.databind.JsonNode content, Class<T> requiredType)
      Method to convert the given JsonNode content to required class
      Type Parameters:
      T - - type reference
      Parameters:
      content - - json node
      requiredType - Contains the return type
      Returns:
      class
    • castTypeFromObj

      public static <T> T castTypeFromObj(Object content, Class<T> requiredType)
      Method to convert the given JsonNode content to required class
      Type Parameters:
      T - - type reference
      Parameters:
      content - - json node
      requiredType - Contains the return type
      Returns:
      class
    • castTypeFromBytes

      public static <T> T castTypeFromBytes(byte[] content, Class<T> requiredType)
      Method to convert the given Bytes content to required class
      Type Parameters:
      T - - type reference
      Parameters:
      content - - json node
      requiredType - Contains the return type
      Returns:
      class
    • castTypeFromString

      public static <T> T castTypeFromString(String content, Class<T> requiredType)
      Method to convert the given JsonNode content to required class
      Type Parameters:
      T - - type reference
      Parameters:
      content - - string data
      requiredType - Contains the return type
      Returns:
      class