Package com.skava.payment.util
Class MapperUtil
java.lang.Object
com.skava.payment.util.MapperUtil
MapperUtil
- Since:
- 17/12/2018
- Author:
- Infosys Equinox
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final com.fasterxml.jackson.databind.ObjectMapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.skava.core.event.Message<T>
castFromTypeRef
(byte[] bs) Method to convert the given bytes into Message T using typeReference.static <T> T
castTypeFromBytes
(byte[] content, Class<T> requiredType) Method to convert the given JsonNode content to required class.static <T> T
castTypeFromObject
(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 classstatic com.fasterxml.jackson.databind.JsonNode
castTypeToJsonNode
(Object content) Method to get the jsonNode for given object.static <T> com.fasterxml.jackson.databind.ObjectReader
Method to get the reader object for the given type.static String
Method to get the writer for the given content
-
Field Details
-
EXCEPTION_CONST
- See Also:
-
objectMapper
public static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
MapperUtil
protected MapperUtil()
-
-
Method Details
-
getReader
Method to get the reader object for the given type.- Type Parameters:
T
- This describes the generic type parameter.- Parameters:
requiredType
- It has the required class.- Returns:
- A
ObjectReader
object.
-
getWriter
Method to get the writer for the given content -
castFromTypeRef
public static <T> com.skava.core.event.Message<T> castFromTypeRef(byte[] bs) Method to convert the given bytes into Message T using typeReference.- Type Parameters:
T
- This describes the generic type parameter.- Parameters:
bs
- It consists of the content which is converted to bytes.- Returns:
- Returns Message T where T is a generic class to which the bytes are converted to.
-
castTypeToJsonNode
Method to get the jsonNode for given object. Replicate for valueToTree- Parameters:
content
- AObject
. It consists of details which needs to be converted to JsonNode.- Returns:
- Returns a
JsonNode
for the given content.
-
castTypeFromObject
Method to convert the given JsonNode content to required class. Replicate for TreeToValue.- Type Parameters:
T
- This describes the generic type parameter.- Parameters:
content
- AObject
. It consists of details which needs to be converted to given type T.requiredType
- It has the required class.- Returns:
- Returns T to which the content needs to be converted.
-
castTypeFromBytes
Method to convert the given JsonNode content to required class.- Type Parameters:
T
- This describes the generic type parameter.- Parameters:
content
- It consists of the content which is converted to bytes. which needs to be converted to given type T.requiredType
- It has the required class.- Returns:
- Returns T to which the content needs to be converted.
-
castTypeFromString
Method to convert the given JsonNode content to required class- Type Parameters:
T
- - type reference- Parameters:
content
- - string datarequiredType
- Contains the return type- Returns:
- class
-