net.fortuna.ical4j.model.property
Class DateProperty

java.lang.Object
  extended bynet.fortuna.ical4j.model.Content
      extended bynet.fortuna.ical4j.model.Property
          extended bynet.fortuna.ical4j.model.property.DateProperty
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DtEnd, DtStart, Due, RecurrenceId, UtcProperty

public abstract class DateProperty
extends Property

Base class for properties with a DATE or DATE-TIME value. Note that some sub-classes may only allow either a DATE or a DATE-TIME value, for which additional rules/validation should be specified.

Author:
Ben Fortuna
See Also:
Serialized Form

Field Summary
protected  TimeZone timezone
           
 
Fields inherited from class net.fortuna.ical4j.model.Property
ACTION, ATTACH, ATTENDEE, CALSCALE, CATEGORIES, CLASS, COMMENT, COMPLETED, CONTACT, CREATED, DESCRIPTION, DTEND, DTSTAMP, DTSTART, DUE, DURATION, EXDATE, EXPERIMENTAL_PREFIX, EXRULE, FREEBUSY, GEO, LAST_MODIFIED, LOCATION, METHOD, ORGANIZER, PERCENT_COMPLETE, PRIORITY, PRODID, RDATE, RECURRENCE_ID, RELATED_TO, REPEAT, REQUEST_STATUS, RESOURCES, RRULE, SEQUENCE, STATUS, SUMMARY, TRANSP, TRIGGER, TZID, TZNAME, TZOFFSETFROM, TZOFFSETTO, TZURL, UID, URL, VERSION
 
Constructor Summary
DateProperty(String name)
           
DateProperty(String name, ParameterList parameters)
           
 
Method Summary
 Date getDate()
           
 String getValue()
           
 boolean isUtc()
          Indicates whether the current date value is specified in UTC time.
 void setDate(Date date)
          Sets the date value of this property.
 void setTimeZone(TimeZone timezone)
          Updates the timezone associated with the property's value.
 void setUtc(boolean utc)
          Resets the VTIMEZONE associated with the property.
 void setValue(String value)
          Default setValue() implementation.
 void validate()
          Perform validation on a property.
 
Methods inherited from class net.fortuna.ical4j.model.Property
equals, getName, getParameter, getParameters, getParameters, hashCode, isCalendarProperty, isComponentProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

timezone

protected TimeZone timezone
Constructor Detail

DateProperty

public DateProperty(String name,
                    ParameterList parameters)

DateProperty

public DateProperty(String name)
Method Detail

getDate

public final Date getDate()
Returns:
Returns the date.

setDate

public final void setDate(Date date)
Sets the date value of this property. The timezone of this instance will also be updated accordingly.

Parameters:
date - The date to set.

setValue

public void setValue(String value)
              throws ParseException
Default setValue() implementation. Allows for either DATE or DATE-TIME values.

Specified by:
setValue in class Property
Parameters:
value - a string representation of the property value
Throws:
ParseException - possibly thrown by setting the value of certain properties

getValue

public String getValue()
Specified by:
getValue in class Property
Returns:
Returns the value.

setTimeZone

public final void setTimeZone(TimeZone timezone)
Updates the timezone associated with the property's value. If the specified timezone is equivalent to UTC any existing TZID parameters will be removed. Note that this method is only applicable where the current date is an instance of DateTime. For all other cases an UnsupportedOperationException will be thrown.


setUtc

public final void setUtc(boolean utc)
Resets the VTIMEZONE associated with the property. If utc is true, any TZID parameters are removed and the Java timezone is updated to UTC time. If utc is false, TZID parameters are removed and the Java timezone is set to the default timezone (i.e. represents a "floating" local time)

Parameters:
utc -

isUtc

public final boolean isUtc()
Indicates whether the current date value is specified in UTC time.

Returns:

validate

public void validate()
              throws ValidationException
Description copied from class: Property
Perform validation on a property.

Specified by:
validate in class Property
Throws:
ValidationException - where the property is not in a valid state