Class CommonUtils


  • public class CommonUtils
    extends Object
    • Constructor Detail

      • CommonUtils

        public CommonUtils()
    • Method Detail

      • getFormattedDate

        public static String getFormattedDate()
      • createGenericResponse

        public static GenericResponse createGenericResponse​(boolean result,
                                                            int responseCode,
                                                            String responseMessage)
      • createGenericResponse

        public static GenericResponse createGenericResponse​(boolean result,
                                                            int responseCode,
                                                            String responseMessage,
                                                            com.fasterxml.jackson.databind.JsonNode node)
      • hasShortCode

        public static boolean hasShortCode​(Map<String,​?> map)
      • hasShortCode

        public static boolean hasShortCode​(String input)
      • jsonStringToMap

        public static Map<String,​Object> jsonStringToMap​(String jsonString)
                                                        throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • mapToJsonString

        public static String mapToJsonString​(Map<String,​Object> mapObj)
                                      throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • isValidJson

        public static boolean isValidJson​(String json)
      • convertIsoToDateString

        public static String convertIsoToDateString​(String isoDateTime)
      • convertStringToLocalDate

        public static LocalDate convertStringToLocalDate​(String dateString)
      • convertLocalDateToString

        public static String convertLocalDateToString​(LocalDate date)
      • toJsonNode

        public static com.fasterxml.jackson.databind.JsonNode toJsonNode​(Object object)
                                                                  throws com.fasterxml.jackson.core.JsonProcessingException
        Converts any Java object into a JsonNode representation.
        Parameters:
        object - the Java object to convert
        Returns:
        JSON representation of the object
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • toPrimitiveOrDefaultFalse

        public static boolean toPrimitiveOrDefaultFalse​(Boolean booleanObject)
        Converts a Boolean object to a boolean primitive. Returns false if the input Boolean object is null.
        Parameters:
        booleanObject - The Boolean object to convert.
        Returns:
        The boolean primitive value, or false if the input is null.