Enum TimeUnitRange

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TimeUnitRange>

    public enum TimeUnitRange
    extends java.lang.Enum<TimeUnitRange>
    A range of time units. The first is more significant than the other (e.g. year-to-day) or the same as the other (e.g. month).
    • Constructor Detail

      • TimeUnitRange

        private TimeUnitRange​(TimeUnit startUnit,
                              TimeUnit endUnit)
        Creates a TimeUnitRange.
        Parameters:
        startUnit - Start time unit
        endUnit - End time unit
    • Method Detail

      • values

        public static TimeUnitRange[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TimeUnitRange c : TimeUnitRange.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TimeUnitRange valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • of

        public static TimeUnitRange of​(TimeUnit startUnit,
                                       TimeUnit endUnit)
        Returns a TimeUnitRange with a given start and end unit.
        Parameters:
        startUnit - Start unit
        endUnit - End unit
        Returns:
        Time unit range, or null if not valid
      • monthly

        public boolean monthly()
        Whether this is in the YEAR-TO-MONTH family of intervals.