Class DateProperty
- java.lang.Object
-
- net.fortuna.ical4j.model.Content
-
- net.fortuna.ical4j.model.Property
-
- net.fortuna.ical4j.model.property.DateProperty
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DtEnd
,DtStart
,Due
,RecurrenceId
,UtcProperty
public abstract class DateProperty extends Property
$Id$ Created on 9/07/2005 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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.fortuna.ical4j.model.Content
Content.Factory
-
-
Field Summary
-
Fields inherited from class net.fortuna.ical4j.model.Property
ACKNOWLEDGED, ACTION, ATTACH, ATTENDEE, BUSYTYPE, CALSCALE, CATEGORIES, CLASS, COMMENT, COMPLETED, CONTACT, COUNTRY, CREATED, DESCRIPTION, DTEND, DTSTAMP, DTSTART, DUE, DURATION, EXDATE, EXPERIMENTAL_PREFIX, EXRULE, EXTENDED_ADDRESS, FREEBUSY, GEO, LAST_MODIFIED, LOCALITY, LOCATION, LOCATION_TYPE, METHOD, NAME, ORGANIZER, PERCENT_COMPLETE, POSTALCODE, PRIORITY, PRODID, RDATE, RECURRENCE_ID, REGION, RELATED_TO, REPEAT, REQUEST_STATUS, RESOURCES, RRULE, SEQUENCE, STATUS, STREET_ADDRESS, SUMMARY, TEL, TRANSP, TRIGGER, TZID, TZNAME, TZOFFSETFROM, TZOFFSETTO, TZURL, UID, URL, VERSION
-
-
Constructor Summary
Constructors Constructor Description DateProperty(String name, ParameterList parameters, PropertyFactory factory)
DateProperty(String name, PropertyFactory factory)
DateProperty(String name, TimeZone timezone, PropertyFactory factory)
Creates a new instance of the named property with an initial timezone.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Property
copy()
Create a (deep) copy of this property.Date
getDate()
TimeZone
getTimeZone()
String
getValue()
int
hashCode()
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)
Publically available method to update the current timezone.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, toString
-
-
-
-
Constructor Detail
-
DateProperty
public DateProperty(String name, ParameterList parameters, PropertyFactory factory)
- Parameters:
name
- the property nameparameters
- a list of initial parameters
-
DateProperty
public DateProperty(String name, PropertyFactory factory)
- Parameters:
name
- the property name
-
DateProperty
public DateProperty(String name, TimeZone timezone, PropertyFactory factory)
Creates a new instance of the named property with an initial timezone.- Parameters:
name
- property nametimezone
- initial timezone
-
-
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 and value 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 classProperty
- Parameters:
value
- a string representation of a DATE or DATE-TIME value- Throws:
ParseException
- where the specified value is not a valid DATE or DATE-TIME representation
-
getValue
public String getValue()
-
setTimeZone
public void setTimeZone(TimeZone timezone)
Publically available method to update the current timezone.- Parameters:
timezone
- a timezone instance
-
getTimeZone
public final TimeZone getTimeZone()
- Returns:
- the timezone
-
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
- a UTC value
-
isUtc
public final boolean isUtc()
Indicates whether the current date value is specified in UTC time.- Returns:
- true if the property is in UTC time, otherwise false
-
validate
public void validate() throws ValidationException
Perform validation on a property.- Specified by:
validate
in classProperty
- Throws:
ValidationException
- where the property is not in a valid state
-
copy
public Property copy() throws IOException, URISyntaxException, ParseException
Create a (deep) copy of this property.- Overrides:
copy
in classProperty
- Returns:
- the copy of the property
- Throws:
IOException
- where an error occurs reading property dataURISyntaxException
- where the property contains an invalid URI valueParseException
- where the property contains an invalid date value
-
-