public class DateDue extends DateOrDateTimeProperty
Defines the due date of a to-do task.
Code sample (creating):
VTodo todo = new VTodo(); //date and time Date datetime = ... DateDue due = new DateDue(datetime); todo.setDateDue(due); //date (without time component) Date date = ... due = new DateDue(date, false); todo.setDateDue(due);
Code sample (reading):
ICalReader reader = ...
ICalendar ical = reader.readNext();
TimezoneInfo tzinfo = reader.getTimezoneInfo();
for (VTodo todo : ical.getTodos()){
DateDue due = todo.getDateDue();
//get property value (ICalDate extends java.util.Date)
ICalDate value = due.getValue();
if (value.hasTime()){
//the value includes a time component
} else {
//the value is just a date
//date object's time is set to "00:00:00" under local computer's default timezone
}
//gets the timezone that the property value was parsed under if you are curious about that
TimeZone tz = tzinfo.getTimeZone(due);
}
Code sample (using timezones):
DateDue due = new DateDue(...); ICalendar ical = new ICalendar(); VTodo todo = new VTodo(); Date datetime = ... todo.setDateDue(due); ical.addTodo(todo); java.util.TimeZone tz = ... ICalWriter writer = new ICalWriter(...); //set the timezone of all date-time property values //date-time property values are written in UTC by default writer.getTimezoneInfo().setDefaultTimeZone(tz); //set the timezone just for this property writer.getTimezoneInfo().setTimeZone(due, tz); //finally, write the iCalendar object writer.write(ical);
valueparameters| Constructor and Description |
|---|
DateDue(Date dueDate)
Creates a due date property.
|
DateDue(Date dueDate,
boolean hasTime)
Creates a due date property.
|
DateDue(DateDue original)
Copy constructor.
|
DateDue(ICalDate dueDate)
Creates a due date property.
|
| Modifier and Type | Method and Description |
|---|---|
DateDue |
copy()
Creates a copy of this property object.
|
setValueequals, getValue, getValue, hashCode, setValue, toStringValues, validate, valueEquals, valueHashCodeaddParameter, getParameter, getParameters, getParameters, removeParameter, setParameter, setParameter, setParameters, toString, validatepublic DateDue(Date dueDate, boolean hasTime)
dueDate - the due datehasTime - true if the value has a time component, false if it is
strictly a datepublic DateDue(ICalDate dueDate)
dueDate - the due datepublic DateDue copy()
ICalPropertyCreates a copy of this property object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
ICalProperty.ICalProperty(ICalProperty) super constructor to ensure that the
parameters are also copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException will be thrown when an attempt is
made to copy the property (such as in the
ICalendar class's copy constructor
).
copy in class ICalPropertyCopyright © 2013-2016 Michael Angstadt. All Rights Reserved.