Class ParsingUtilities


  • public class ParsingUtilities
    extends Object
    • Field Detail

      • jsonFactory

        public static com.fasterxml.jackson.core.JsonFactory jsonFactory
      • mapper

        public static final com.fasterxml.jackson.databind.ObjectMapper mapper
      • defaultFilters

        public static final com.fasterxml.jackson.databind.ser.FilterProvider defaultFilters
      • saveFilters

        public static final com.fasterxml.jackson.databind.ser.FilterProvider saveFilters
      • saveWriter

        public static final com.fasterxml.jackson.databind.ObjectWriter saveWriter
      • defaultWriter

        public static final com.fasterxml.jackson.databind.ObjectWriter defaultWriter
    • Constructor Detail

      • ParsingUtilities

        public ParsingUtilities()
    • Method Detail

      • parseUrlParameters

        public static Properties parseUrlParameters​(javax.servlet.http.HttpServletRequest request)
      • encode

        public static String encode​(String s)
        Encode a string as UTF-8.
      • decode

        public static String decode​(String s)
        Decode a string from UTF-8 encoding.
      • dateToString

        public static String dateToString​(OffsetDateTime d)
        Convert a date/time to an ISO_LOCAL_DATE_TIME string
        Parameters:
        d - the date to be written
        Returns:
        string with ISO_LOCAL_DATE_TIME formatted date and time
      • stringToDate

        public static OffsetDateTime stringToDate​(String s)
        Parse an ISO_LOCAL_DATE_TIME formatted string into a Java Date. For backward compatibility, to support the version <= 2.8, cannot use the DateTimeFormatter.ISO_OFFSET_DATE_TIME. Instead, use the ISO8601 below format: yyyy-MM-dd'T'HH:mm:ss'Z'
        Parameters:
        s - the string to be parsed
        Returns:
        LocalDateTime or null if the parse failed
      • offsetDateTimeToCalendar

        public static Calendar offsetDateTimeToCalendar​(OffsetDateTime offsetDateTime)
      • isDate

        public static boolean isDate​(Object o)
      • toDate

        public static OffsetDateTime toDate​(Date date)
        Converts an old-style Java Date to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).
      • toDate

        public static OffsetDateTime toDate​(Calendar date)
        Converts an old-style Java Calendar to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).
      • evaluateJsonStringToObjectNode

        public static com.fasterxml.jackson.databind.node.ObjectNode evaluateJsonStringToObjectNode​(String optionsString)
      • evaluateJsonStringToArrayNode

        public static com.fasterxml.jackson.databind.node.ArrayNode evaluateJsonStringToArrayNode​(String parameter)
                                                                                           throws IOException
        Throws:
        IOException