public class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static DateTimeFormatter |
DT_FORMATTER |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkError(com.fasterxml.jackson.databind.JsonNode root)
Checks if the JSON is error and throws exception if error found.
|
static String |
fixString(String inputStr)
Strips blank spaces at beginning and end of string.
|
static boolean |
isEmptyJson(String json)
Returns true if the json is empty.
|
static boolean |
isValidEthAddress(byte[] addr) |
static LocalDateTime |
parseDate(com.fasterxml.jackson.databind.JsonNode node,
String fieldName)
Produces DateTime from given node and field name
|
static String |
prettyfyJson(com.fasterxml.jackson.databind.ObjectMapper mapper,
String body) |
static void |
prettyPrint(com.fasterxml.jackson.databind.ObjectMapper mapper,
String body) |
static BigDecimal |
toBD(com.fasterxml.jackson.databind.JsonNode node,
String fieldName)
Returns the BigDecimal for the fieldName.
|
static BigDecimal |
toBD(String value)
Converts the String to BigDecimal.
|
static BigDecimal |
toBDrequired(com.fasterxml.jackson.databind.JsonNode node,
String fieldName)
Returns the BigDecimal for the fieldName.
|
static Long |
toEpochSecond(LocalDateTime dateTime) |
public static final DateTimeFormatter DT_FORMATTER
public static final LocalDateTime parseDate(com.fasterxml.jackson.databind.JsonNode node, String fieldName)
node - JsonNodefieldName - Field Namepublic static final void checkError(com.fasterxml.jackson.databind.JsonNode root)
root - JsonNodepublic static final boolean isEmptyJson(String json)
json - JSON string to checkpublic static final BigDecimal toBD(com.fasterxml.jackson.databind.JsonNode node, String fieldName)
node - JSON NodefieldName - JSON field name to processpublic static final BigDecimal toBDrequired(com.fasterxml.jackson.databind.JsonNode node, String fieldName)
node - JSON NodefieldName - JSON field name to processpublic static final BigDecimal toBD(String value)
value - String to convertpublic static boolean isValidEthAddress(byte[] addr)
public static Long toEpochSecond(LocalDateTime dateTime)
public static final String fixString(String inputStr)
inputStr - String to fixpublic static String prettyfyJson(com.fasterxml.jackson.databind.ObjectMapper mapper, String body)
public static void prettyPrint(com.fasterxml.jackson.databind.ObjectMapper mapper,
String body)
Copyright © 2019. All rights reserved.