Class ExplicitDate

java.lang.Object
oracle.as.scheduler.ExplicitDate
All Implemented Interfaces:
Serializable

public class ExplicitDate extends Object implements Serializable
Defines a date and time for use in a Schedule or Exclusion.

While the Recurrence defines a repetition rule, instances of this class can be used for specifying explicit date/times within Schedule and Exclusion definitions. ExplicitDate can be constructed by using appropriate fields defined in the RecurrenceFields class.

The class provides the ability to define partial date (when compared with java.util.Calendar where the time part may or may not be specified. Also all other fields such as TimeZone are not defined for this class. Such explicit dates are required for defining partial dates to be included or excluded from a Schedule or an Exclusion definition.

When the time is not specified in an ExplicitDate, the containing Schedule and/or Exclusion computes it appropriately.

Example:

Consider an example Schedule that indicates every Monday plus on the 17th of August 2006. Here the 17th of August 2006 is a partial date since it does not have the time part specified. This shouldtypically be defined via an instance of ExplicitDate class.

See Also:
  • Constructor Details

  • Method Details

    • fromCalendar

      public static ExplicitDate fromCalendar(Calendar cal, boolean useTime)
      Constructs a new instance of ExplicitDate from a given Calendar instance.

      The new instance of ExplicitDate has its year, month, day parts extracted from the given Calender instance. Optionally the hour, minute and second parts are also extracted from the Calendar if specified.

      All other fields such as time zone, milliseconds, etc of the Calendar instance are completely ignored.

      Parameters:
      cal - instance of Calendar from which a new instance of ExplicitDate will be constructed.
      useTime - flag indicating whether the hour, minute, and second parts should also be consumed or not. If true, the new ExplicitDate instance will have its time of day part also set from the given Calendar instance. If false, only year, month and day will be set.
      Returns:
      an instance of ExplicitDate.
    • toCalendar

      public Calendar toCalendar()
      Populates this fields of this ExplicitDate into an instance of Calendar.

      This method is equivalent to toCalendar(Calendar.getInstance()). It calls Calendar.getInstance() to get a Calendar object and then passes that object to toCalendar(Calendar).

      Only those fields available in this instance are used to set fields of the Calendar object. Other Calendar fields, such as time zone, are not changed and will reflect the value returned from the call to Calendar.getInstance().

      Returns:
      an instance of Calender with its fields set as per this ExplicitDate instance.
    • toCalendar

      public Calendar toCalendar(TimeZone tz)
      Populates this fields of this ExplicitDate into an instance of Calendar with a specified time zone.

      This method is equivalent to toCalendar(Calendar.getInstance()). It calls Calendar.getInstance() to get a Calendar object and then passes that object to toCalendar(Calendar).

      Only those fields available in this instance are used to set fields of the Calendar object. Other Calendar fields, such as time zone, are not changed and will reflect the value returned from the call to Calendar.getInstance(TimeZone).

      Parameters:
      tz - the time zone this instance of Calendar is to be created with.
      Returns:
      an instance of Calender with its fields set as per this ExplicitDate instance.
    • toCalendar

      public Calendar toCalendar(Calendar cal)
      Populates values from this ExplicitDate instance into the given instance of Calendar.

      The method sets all the fields available in this object into the given Calendar. Remaining fields are left unchanged. For example, if this object does not have TIME_OF_DAY set, then the time parts of the specified Calendar instance are left unchanged.

      Parameters:
      cal - the Calendar instance that will be modified with the available fields of this object. Must not be null.
      Returns:
      the modified Calendar instance.
    • getYear

      public RecurrenceFields.YEAR getYear()
      Gets the year part of this ExplicitDate object.
      Returns:
      the year represented by this object.
    • setYear

      public void setYear(RecurrenceFields.YEAR year)
      Sets the year of this ExplicitDate object to the given value.
      Parameters:
      year - the year to be set for this object.
    • getMonth

      public RecurrenceFields.MONTH_OF_YEAR getMonth()
      Gets the month part of this ExplicitDate object.
      Returns:
      the month represented by this object.
    • setMonth

      public void setMonth(RecurrenceFields.MONTH_OF_YEAR month)
      Sets the month of this ExplicitDate object to the given value.
      Parameters:
      month - the month to be set for this object.
    • getDay

      Gets the day part of this ExplicitDate object.
      Returns:
      the day represented by this object.
    • setDay

      public void setDay(RecurrenceFields.DAY_OF_MONTH day)
      Sets the day of this ExplicitDate object to the given value.
      Parameters:
      day - the day to be set for this object.
    • getTime

      public RecurrenceFields.TIME_OF_DAY getTime()
      Gets the time part of this ExplicitDate object.
      Returns:
      the time represented by this object.
    • setTime

      public void setTime(RecurrenceFields.TIME_OF_DAY time)
      Sets the time of this ExplicitDate object to the given value.
      Parameters:
      time - the time to be set for this object.
    • equals

      public boolean equals(Object obj)
      Compares an object for equality with this ExplicitDate object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with this ExplicitDate.
      Returns:
      true if the object passed in is an instanceof ExplicitDate and is equal to this ExplicitDate, or false otherwise.
    • hashCode

      public int hashCode()
      The hash code value of this ExplicitDate object.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value of this object.