java.lang.Object
net.fortuna.ical4j.model.Content
net.fortuna.ical4j.model.Property
net.fortuna.ical4j.model.property.DateProperty<T>
- All Implemented Interfaces:
Serializable,Comparable<Property>,FluentProperty,Prototype<Property>
- Direct Known Subclasses:
Acknowledged,Completed,Created,DtEnd,DtStamp,DtStart,Due,LastModified,RecurrenceId,Trigger,TzUntil
$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.
Note that generics have been introduced as part of the migration to the new Java Date/Time API.
Date properties should now indicate the applicable
Temporal type for the property.
For example:
- UTC-based properties should use
Instantto represent UTC time - Date-only properties should use
LocalDateto represent a date value - Date-time properties should use
ZonedDateTimeto represent a date-time value influenced by timezone rules
- See Also:
-
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, CALENDAR_ADDRESS, 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, PARTICIPANT_TYPE, PERCENT_COMPLETE, POSTALCODE, PRIORITY, PRODID, PROXIMITY, RDATE, RECURRENCE_ID, REGION, RELATED_TO, REPEAT, REQUEST_STATUS, RESOURCE_TYPE, RESOURCES, RRULE, SEQUENCE, STATUS, STREET_ADDRESS, STRUCTURED_DATA, STYLED_DESCRIPTION, SUMMARY, TEL, TRANSP, TRIGGER, TZID, TZID_ALIAS_OF, TZNAME, TZOFFSETFROM, TZOFFSETTO, TZUNTIL, TZURL, UID, URL, VERSION, XML -
Constructor Summary
ConstructorsConstructorDescriptionDateProperty(Enum<?> name, CalendarDateFormat parseFormat, Value defaultValueParam) DateProperty(Enum<?> name, ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam) DateProperty(String name) DateProperty(String name, CalendarDateFormat parseFormat, Value defaultValueParam) DateProperty(String name, ParameterList parameters) DateProperty(String name, ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam) -
Method Summary
Modifier and TypeMethodDescriptionintgetDate()This method will attempt to dynamically cast the internalTemporalvalue to the required return value.getValue()inthashCode()final booleanisUtc()Indicates whether the current date value is specified in UTC time.voidvoidSets the date value of this property.voidsetDefaultTimeZone(ZoneId defaultTimeZone) A default timezone may be specified for interpreting floating DATE-TIME values.voidsetTimeZoneRegistry(TimeZoneRegistry timeZoneRegistry) voidDefault setValue() implementation.validate()Perform validation on a property.Methods inherited from class net.fortuna.ical4j.model.Property
add, copy, equals, getFluentTarget, getName, getParameter, getParameter, getParameterList, getParameters, getPrefix, getRequiredParameter, getRequiredParameter, newFactory, remove, removeAll, replace, setParameters, setPrefix, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.fortuna.ical4j.model.FluentProperty
withParameter
-
Constructor Details
-
DateProperty
- Parameters:
name- the property nameparameters- a list of initial parameters
-
DateProperty
public DateProperty(String name, ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam) -
DateProperty
public DateProperty(Enum<?> name, ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam) -
DateProperty
- Parameters:
name- the property name
-
DateProperty
-
DateProperty
- Parameters:
name- an enum representing a property nameparseFormat-defaultValueParam-
-
-
Method Details
-
getDate
This method will attempt to dynamically cast the internalTemporalvalue to the required return value. e.g. LocalDate localDate = dateProperty.getDate();- Returns:
- Returns the date.
-
setDate
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
Default setValue() implementation. Allows for either DATE or DATE-TIME values. Note that this method will use the system default zone rules to parse the string value. For parsing string values in a different timezone useTemporalAdapter.parse(String, ZoneId)andsetDate(Temporal).- Specified by:
setValuein classProperty- Parameters:
value- a string representation of a DATE or DATE-TIME value- Throws:
DateTimeParseException
-
getValue
-
setTimeZoneRegistry
-
refreshParameters
public void refreshParameters() -
setDefaultTimeZone
A default timezone may be specified for interpreting floating DATE-TIME values. In the absence of a default timezone the system default timezone will be used.- Parameters:
defaultTimeZone- a timezone identifier
-
hashCode
public int hashCode() -
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
Perform validation on a property.- Specified by:
validatein classProperty- Throws:
ValidationException- where the property is not in a valid state
-
compareTo
-