Top Description Fields Constructors Methods
net.fortuna.ical4j.model.property

public abstract Class DateProperty<T extends Temporal>

extends Property
Class Inheritance
Known Direct Subclasses
net.fortuna.ical4j.model.property.RecurrenceId, net.fortuna.ical4j.model.property.Trigger, net.fortuna.ical4j.model.property.TzUntil, net.fortuna.ical4j.model.property.DtEnd, net.fortuna.ical4j.model.property.DtStamp, net.fortuna.ical4j.model.property.DtStart, net.fortuna.ical4j.model.property.Due, net.fortuna.ical4j.model.property.LastModified, net.fortuna.ical4j.model.property.Acknowledged, net.fortuna.ical4j.model.property.Completed, net.fortuna.ical4j.model.property.Created
Imports
net.fortuna.ical4j.model.*, net.fortuna.ical4j.model.parameter.TzId, .Value, net.fortuna.ical4j.util.CompatibilityHints, .Strings, net.fortuna.ical4j.validate.ValidationException, .ValidationResult, net.fortuna.ical4j.validate.property.DatePropertyValidator, org.jetbrains.annotations.NotNull, org.slf4j.LoggerFactory, java.time.ZoneId, .ZoneOffset, .ZonedDateTime, java.time.format.DateTimeParseException, java.time.temporal.Temporal, java.util.Optional

$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:

Author
Ben Fortuna

Field Summary

Modifier and TypeField and Description
private TemporalAdapter<T>
private ZoneId
private final Value
private final CalendarDateFormat
private static final long
private transient TimeZoneRegistry
Inherited from net.fortuna.ical4j.model.Property:
ACKNOWLEDGEDACTIONATTACHATTENDEEBUSYTYPECALENDAR_ADDRESSCALSCALECATEGORIESCLASSCOMMENTCOMPLETEDCONTACTCOUNTRYCREATEDDESCRIPTIONDTENDDTSTAMPDTSTARTDUEDURATIONEXDATEEXPERIMENTAL_PREFIXEXRULEEXTENDED_ADDRESSFREEBUSYGEOLAST_MODIFIEDLOCALITYLOCATIONLOCATION_TYPEMETHODNAMEORGANIZERPARTICIPANT_TYPEPERCENT_COMPLETEPOSTALCODEPRIORITYPRODIDPROXIMITYRDATERECURRENCE_IDREGIONRELATED_TOREPEATREQUEST_STATUSRESOURCE_TYPERESOURCESRRULESEQUENCESTATUSSTREET_ADDRESSSTRUCTURED_DATASTYLED_DESCRIPTIONSUMMARYTELTRANSPTRIGGERTZIDTZID_ALIAS_OFTZNAMETZOFFSETFROMTZOFFSETTOTZUNTILTZURLUIDURLVERSIONXML

Constructor Summary

AccessConstructor and Description
public
DateProperty(final String
the property name
name
,
final ParameterList
a list of initial parameters
parameters
)

public
DateProperty(final String name, final ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam)

public
DateProperty(final Enum<?> name, final ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam)

public
DateProperty(final String
the property name
name
)

public
DateProperty(final String name, CalendarDateFormat parseFormat, Value defaultValueParam)

public
DateProperty(final Enum<?>
an enum representing a property name
name
,
CalendarDateFormat parseFormat, Value defaultValueParam)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(@NotNull Property
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public T

Returns:

Returns the date.
getDate
()

This method will attempt to dynamically cast the internal Temporal value to the required return value.

public String
public int
hashCode()

Overrides net.fortuna.ical4j.model.Property.hashCode.

Returns a hash code value for this object.

public final boolean

Returns:

true if the property is in UTC time, otherwise false
isUtc
()

Indicates whether the current date value is specified in UTC time.

public void
refreshParameters()

Sometimes following a value update the Value and TzId parameters should be updated to reflect the new value.

public void
setDate(T
The date to set.
date
)

Sets the date value of this property.

public void
setDefaultTimeZone(ZoneId
a timezone identifier
defaultTimeZone
)

A default timezone may be specified for interpreting floating DATE-TIME values.

public void
public void
setValue(final String
a string representation of a DATE or DATE-TIME value
value
)

Implements abstract net.fortuna.ical4j.model.Property.setValue.

Default setValue() implementation.

private boolean
public ValidationResult
validate()

Implements abstract net.fortuna.ical4j.model.Property.validate.

Perform validation on a property.

Inherited from net.fortuna.ical4j.model.Property:
addcompareTocopyequalsgetFluentTargetgetNamegetParametergetParametergetParameterListgetParametersgetPrefixgetRequiredParametergetRequiredParameternewFactoryremoveremoveAllreplacesetParameterssetPrefixtoString

Field Detail

dateback to summary
private TemporalAdapter<T> date
defaultTimeZoneback to summary
private ZoneId defaultTimeZone
defaultValueParamback to summary
private final Value defaultValueParam
parseFormatback to summary
private final CalendarDateFormat parseFormat
serialVersionUIDback to summary
private static final long serialVersionUID

Hides net.fortuna.ical4j.model.Property.serialVersionUID.

timeZoneRegistryback to summary
private transient TimeZoneRegistry timeZoneRegistry

Constructor Detail

DatePropertyback to summary
public DateProperty(final String name, final ParameterList parameters)
Parameters
name:String

the property name

parameters:ParameterList

a list of initial parameters

DatePropertyback to summary
public DateProperty(final String name, final ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam)
DatePropertyback to summary
public DateProperty(final Enum<?> name, final ParameterList parameters, CalendarDateFormat parseFormat, Value defaultValueParam)
DatePropertyback to summary
public DateProperty(final String name)
Parameters
name:String

the property name

DatePropertyback to summary
public DateProperty(final String name, CalendarDateFormat parseFormat, Value defaultValueParam)
DatePropertyback to summary
public DateProperty(final Enum<?> name, CalendarDateFormat parseFormat, Value defaultValueParam)
Parameters
name:Enum<?>

an enum representing a property name

Method Detail

compareToback to summary
public int compareTo(@NotNull Property o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:@NotNull Property

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
getDateback to summary
public T getDate()

This method will attempt to dynamically cast the internal Temporal value to the required return value. e.g. LocalDate localDate = dateProperty.getDate();

Returns:T

Returns the date.

Annotations
@SuppressWarnings:unchecked
getValueback to summary
public String getValue()

Implements abstract net.fortuna.ical4j.model.Content.getValue.

Returns:String

Doc from net.fortuna.ical4j.model.Content.getValue.

the content value

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides net.fortuna.ical4j.model.Property.hashCode.

Doc from net.fortuna.ical4j.model.Property.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
isUtcback to summary
public final boolean isUtc()

Indicates whether the current date value is specified in UTC time.

Returns:boolean

true if the property is in UTC time, otherwise false

refreshParametersback to summary
public void refreshParameters()

Sometimes following a value update the Value and TzId parameters should be updated to reflect the new value. This method will examine the current value and modify these parameters accordingly.

setDateback to summary
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:T

The date to set.

setDefaultTimeZoneback to summary
public void setDefaultTimeZone(ZoneId defaultTimeZone)

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:ZoneId

a timezone identifier

setTimeZoneRegistryback to summary
public void setTimeZoneRegistry(TimeZoneRegistry timeZoneRegistry)
setValueback to summary
public void setValue(final String value) throws DateTimeParseException

Implements abstract net.fortuna.ical4j.model.Property.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 use TemporalAdapter#parse(String, ZoneId) and DateProperty#setDate(Temporal).

Parameters
value:String

a string representation of a DATE or DATE-TIME value

Annotations
@Override
@SuppressWarnings:unchecked
shouldApplyTimezoneback to summary
private boolean shouldApplyTimezone()
validateback to summary
public ValidationResult validate() throws ValidationException

Implements abstract net.fortuna.ical4j.model.Property.validate.

Doc from net.fortuna.ical4j.model.Property.validate.

Perform validation on a property.

Annotations
@Override
Exceptions
ValidationException:
where the property is not in a valid state