Class SqlDateSerializer

All Implemented Interfaces:
ModelSerializer

class SqlDateSerializer extends DateSerializer<Date>
Common serializer for Date and Date types.
  • Constructor Details

  • Method Details

    • toInstant

      protected Instant toInstant(Date value)
      Description copied from class: AbstractDateSerializer
      Convert java.time object to epoch milliseconds instant. Discards zone offset and zone id information.
      Overrides:
      toInstant in class DateSerializer<Date>
      Parameters:
      value - date object to convert
      Returns:
      instant
    • formatDefault

      protected String formatDefault(Date value, Locale locale)
      Description copied from class: AbstractDateSerializer
      Format with default formatter for a given java.time date object. Different default formatter for each date object type is used.
      Overrides:
      formatDefault in class DateSerializer<Date>
      Parameters:
      value - date object
      locale - locale from annotation / default not null
      Returns:
      formatted date obj as string
    • formatWithFormatter

      protected String formatWithFormatter(Date value, DateTimeFormatter formatter)
      Description copied from class: AbstractDateSerializer
      Format date object with given formatter.
      Overrides:
      formatWithFormatter in class DateSerializer<Date>
      Parameters:
      value - date object to format
      formatter - formatter to format with
      Returns:
      formatted result