Class InputDate


  • public class InputDate
    extends Object
    The JAX-RS spec requires that an input bean for QueryParam or PathParam have either a String constructor or a static valueOf(String) method.

    This is that bean, for dates.

    The string input must either the ISO8601 local date, offset date time, or instant formats. Other formats will not be interpreted successfully.

    The stored value will be a ZonedDateTime by default.

    See Also:
    QueryParam
    • Constructor Detail

      • InputDate

        public InputDate​(long input)
        Constructs a new InputDate from a long value
        Parameters:
        input - an epoch millisecond timestamp
      • InputDate

        public InputDate​(Instant from)
        Constructs a new InputDate from an instant
        Parameters:
        from - An instant
      • InputDate

        public InputDate​(Date input)
        Constructs a new InputDate from a Date
        Parameters:
        input - The input date
      • InputDate

        public InputDate​(ZonedDateTime zdt)
        Constructs a new InputDate from a ZonedDateTime.

        The value is stored directly in this class.

        Parameters:
        zdt - The ZonedDateTime input
    • Method Detail

      • valueOf

        public static InputDate valueOf​(String input)
        Translates the String to an InputDate.

        This is the method required by JAX-RS.

        Parameters:
        input - The input string, in either epoch milliseconds or ISO8601 format
        Returns:
        The InputDate
      • toEpochMillis

        public long toEpochMillis()
        Returns the epoch millisecond rendition of the date
        Returns:
        The date in epoch milliseconds
      • toJavaData

        public Date toJavaData()
        Returns the java.util.Date object
        Returns:
        The java date object