Class DateProperty<T extends Temporal>
- 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
- Direct Known Subclasses:
Acknowledged
,Completed
,Created
,DtEnd
,DtStamp
,DtStart
,Due
,LastModified
,RecurrenceId
,Trigger
,TzUntil
public abstract class DateProperty<T extends Temporal> 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. Note that generics have been introduced as part of the migration to the new Java Date/Time API. Date properties should now indicate the applicableTemporal
type for the property. For example:- UTC-based properties should use
Instant
to represent UTC time - Date-only properties should use
LocalDate
to represent a date value - Date-time properties should use
ZonedDateTime
to represent a date-time value influenced by timezone rules
- 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, 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
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Property o)
T
getDate()
This method will attempt to dynamically cast the internalTemporal
value to the required return value.String
getValue()
int
hashCode()
boolean
isUtc()
Indicates whether the current date value is specified in UTC time.void
setDate(T date)
Sets the date value of this property.void
setTimeZoneRegistry(TimeZoneRegistry timeZoneRegistry)
void
setValue(String value)
Default setValue() implementation.ValidationResult
validate()
Perform validation on a property.-
Methods inherited from class net.fortuna.ical4j.model.Property
add, copy, equals, getFluentTarget, getName, getParameter, getParameterList, getParameters, getRequiredParameter, newFactory, remove, removeAll, replace, setParameters, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.fortuna.ical4j.model.FluentProperty
withParameter
-
-
-
-
Constructor Detail
-
DateProperty
public DateProperty(String name, ParameterList parameters)
- Parameters:
name
- the property nameparameters
- a list of initial parameters
-
DateProperty
public DateProperty(String name, ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam)
-
DateProperty
public DateProperty(String name)
- Parameters:
name
- the property name
-
DateProperty
public DateProperty(String name, CalendarDateFormat parseFormat, Value defaultValueParam)
-
-
Method Detail
-
getDate
public T getDate()
This method will attempt to dynamically cast the internalTemporal
value to the required return value. e.g. LocalDate localDate = dateProperty.getDate();- Returns:
- Returns the date.
-
setDate
public void setDate(T 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 DateTimeParseException
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:
setValue
in classProperty
- Parameters:
value
- a string representation of a DATE or DATE-TIME value- Throws:
DateTimeParseException
-
getValue
public String getValue()
-
setTimeZoneRegistry
public void setTimeZoneRegistry(TimeZoneRegistry timeZoneRegistry)
-
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 ValidationResult validate() throws ValidationException
Perform validation on a property.- Specified by:
validate
in classProperty
- Throws:
ValidationException
- where the property is not in a valid state
-
-