Enum TimeRange

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

    public enum TimeRange
    extends java.lang.Enum<TimeRange>
    JasperReports scriptlet to retrieve start and end dates from predefined ranges: last year, last month, this year, this month
    Author:
    ronny
    • Enum Constant Detail

      • LAST_SEVEN_DAYS

        public static final TimeRange LAST_SEVEN_DAYS
      • LAST_MONTH

        public static final TimeRange LAST_MONTH
      • LAST_YEAR

        public static final TimeRange LAST_YEAR
      • THIS_MONTH

        public static final TimeRange THIS_MONTH
      • THIS_YEAR

        public static final TimeRange THIS_YEAR
    • Method Detail

      • values

        public static TimeRange[] 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 (TimeRange c : TimeRange.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TimeRange 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
      • getEndDate

        public java.util.Date getEndDate()
      • getStartDate

        public abstract java.util.Date getStartDate()
      • getStartDate

        public static java.util.Date getStartDate​(java.lang.String range)

        getStartDate

        Parameters:
        range - a String object
        Returns:
        a Timestamp object
      • getEndDate

        public static java.util.Date getEndDate​(java.lang.String range)

        getEndDate

        Parameters:
        range - a String object
        Returns:
        a Timestamp object