public class DateEnd extends DateOrDateTimeProperty
Defines the end date of an event or free/busy component.
Code sample (creating):
VEvent event = new VEvent(); //date and time Date datetime = ... DateEnd dtend = new DateEnd(datetime); event.setDateEnd(dtend); //date (without time component) Date date = ... dtend = new DateEnd(date, false); event.setDateEnd(dtend);
Code sample (reading):
ICalendar ical = ...
for (VEvent event : ical.getEvents()){
DateEnd dtend = event.getDateEnd();
//get property value (ICalDate extends java.util.Date)
ICalDate value = dtend.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(dtend);
}
Code sample (using timezones):
ICalendar ical = new ICalendar(); VEvent event = new VEvent(); Date datetime = ... DateEnd dtend = new DateEnd(datetime); event.setDateEnd(dtend); ical.addEvent(event); TimezoneAssignment tz = ... //set the timezone of all date-time property values //date-time property values are written in UTC by default ical.getTimezoneInfo().setDefaultTimezone(tz); //or set the timezone just for this property ical.getTimezoneInfo().setTimezone(dtend, tz); //finally, write the iCalendar object ICalWriter writer = ... writer.write(ical);
valueparameters| Constructor and Description |
|---|
DateEnd(Date endDate)
Creates an end date property.
|
DateEnd(Date endDate,
boolean hasTime)
Creates an end date property.
|
DateEnd(DateEnd original)
Copy constructor.
|
DateEnd(ICalDate dateEnd)
Creates an end date property.
|
| Modifier and Type | Method and Description |
|---|---|
DateEnd |
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 DateEnd(Date endDate)
endDate - the end datepublic DateEnd(Date endDate, boolean hasTime)
endDate - the end datehasTime - true if the value has a time component, false if it is
strictly a datepublic DateEnd(ICalDate dateEnd)
dateEnd - the end datepublic DateEnd 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.