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>
- Direct Known Subclasses:
Acknowledged,Completed,Created,DtEnd,DtStamp,DtStart,Due,LastModified,RecurrenceId,Trigger
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 applicableTemporaltype 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:
- 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, TZNAME, TZOFFSETFROM, TZOFFSETTO, 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 intcompareTo(Property o)TgetDate()This method will attempt to dynamically cast the internalTemporalvalue to the required return value.StringgetValue()inthashCode()booleanisUtc()Indicates whether the current date value is specified in UTC time.voidsetDate(T date)Sets the date value of this property.voidsetTimeZoneRegistry(TimeZoneRegistry timeZoneRegistry)voidsetValue(String value)Default setValue() implementation.voidvalidate()Perform validation on a property.-
Methods inherited from class net.fortuna.ical4j.model.Property
add, copy, equals, getName, getParameter, getParameterList, getParameters, getRequiredParameter, newFactory, remove, removeAll, replace, setParameters, toString
-
-
-
-
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 internalTemporalvalue 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:
setValuein 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 void validate() throws ValidationExceptionPerform validation on a property.- Specified by:
validatein classProperty- Throws:
ValidationException- where the property is not in a valid state
-
-