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

public Class Duration

extends Property
Class Inheritance
Imports
net.fortuna.ical4j.model.*, net.fortuna.ical4j.validate.ValidationException, .ValidationResult, net.fortuna.ical4j.validate.property.DateTimePropertyValidators, java.time.temporal.Temporal, .TemporalAmount, java.util.Date

$Id$

Created: [Apr 6, 2004]

Defines a DURATION iCalendar component property.

3.3.6.  Duration

Value Name:  DURATION

Purpose:  This value type is used to identify properties that contain
a duration of time.

Format Definition:  This value type is defined by the following
notation:

dur-value  = (["+"] / "-") "P" (dur-date / dur-time / dur-week)

dur-date   = dur-day [dur-time]
dur-time   = "T" (dur-hour / dur-minute / dur-second)
dur-week   = 1*DIGIT "W"
dur-hour   = 1*DIGIT "H" [dur-minute]
dur-minute = 1*DIGIT "M" [dur-second]
dur-second = 1*DIGIT "S"
dur-day    = 1*DIGIT "D"

Description:  If the property permits, multiple "duration" values are
specified by a COMMA-separated list of values.  The format is
based on the [ISO.8601.2004] complete representation basic format
with designators for the duration of time.  The format can
represent nominal durations (weeks and days) and accurate
durations (hours, minutes, and seconds).  Note that unlike
[ISO.8601.2004], this value type doesn't support the "Y" and "M"
designators to specify durations in terms of years and months.

The duration of a week or a day depends on its position in the
calendar.  In the case of discontinuities in the time scale, such
as the change from standard time to daylight time and back, the
computation of the exact duration requires the subtraction or
addition of the change of duration of the discontinuity.  Leap
seconds MUST NOT be considered when computing an exact duration.
When computing an exact duration, the greatest order time
components MUST be added first, that is, the number of days MUST
be added first, followed by the number of hours, number of
minutes, and number of seconds.

Negative durations are typically used to schedule an alarm to
trigger before an associated time (see Section 3.8.6.3).

No additional content value encoding (i.e., BACKSLASH character
encoding, see Section 3.3.11) are defined for this value type.

Example:  A duration of 15 days, 5 hours, and 20 seconds would be:

P15DT5H0M20S

A duration of 7 weeks would be:

P7W
Author
Ben Fortuna

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private TemporalAmountAdapter
private static final long
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
Duration()

Default constructor.

public
public
Duration(final ParameterList
a list of parameters for this component
aList
,
final String
a value string for this component
aValue
)

public
Duration(final Dur
a duration value
duration
)
Deprecated

public
Duration(final TemporalAmount
a duration value
duration
)

public
Duration(final ParameterList
a list of parameters for this component
aList
,
final Dur
a duration value
duration
)
Deprecated

public
Duration(final ParameterList
a list of parameters for this component
aList
,
final TemporalAmount
a duration value
duration
)

public
Duration(final Date
the starting time for the duration
start
,
final Date
the end time for the duration
end
)

Constructs a new duration representing the time between the specified start date and end date.

public
Duration(final Temporal
the starting time for the duration
start
,
final Temporal
the end time for the duration
end
)

Constructs a new duration representing the time between the specified start date and end date.

Method Summary

Modifier and TypeMethod and Description
public final TemporalAmount

Returns:

Returns the duration.
getDuration
()

public final String
protected PropertyFactory<Duration>
newFactory()

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

Returns a new property factory used to create deep copies.

public final void
setDuration(final TemporalAmount
The duration to set.
duration
)

public final void
setValue(final String
a string representation of the property value
aValue
)

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

Sets the current value of the property.

public ValidationResult
validate()

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

Perform validation on a property.

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

Field Detail

durationback to summary
private TemporalAmountAdapter duration
serialVersionUIDback to summary
private static final long serialVersionUID

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

Constructor Detail

Durationback to summary
public Duration()

Default constructor.

Durationback to summary
public Duration(String value)
Durationback to summary
public Duration(final ParameterList aList, final String aValue)
Parameters
aList:ParameterList

a list of parameters for this component

aValue:String

a value string for this component

Durationback to summary
public Duration(final Dur duration)

Deprecated

Parameters
duration:Dur

a duration value

Annotations
@Deprecated
Durationback to summary
public Duration(final TemporalAmount duration)
Parameters
duration:TemporalAmount

a duration value

Durationback to summary
public Duration(final ParameterList aList, final Dur duration)

Deprecated

Parameters
aList:ParameterList

a list of parameters for this component

duration:Dur

a duration value

Annotations
@Deprecated
Durationback to summary
public Duration(final ParameterList aList, final TemporalAmount duration)
Parameters
aList:ParameterList

a list of parameters for this component

duration:TemporalAmount

a duration value

Durationback to summary
public Duration(final Date start, final Date end)

Constructs a new duration representing the time between the specified start date and end date.

Parameters
start:Date

the starting time for the duration

end:Date

the end time for the duration

Annotations
@Deprecated
Durationback to summary
public Duration(final Temporal start, final Temporal end)

Constructs a new duration representing the time between the specified start date and end date.

Parameters
start:Temporal

the starting time for the duration

end:Temporal

the end time for the duration

Method Detail

getDurationback to summary
public final TemporalAmount getDuration()
Returns:TemporalAmount

Returns the duration.

getValueback to summary
public final 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
newFactoryback to summary
protected PropertyFactory<Duration> newFactory()

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

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

Returns a new property factory used to create deep copies.

Returns:PropertyFactory<Duration>

a property factory instance

Annotations
@Override
setDurationback to summary
public final void setDuration(final TemporalAmount duration)
Parameters
duration:TemporalAmount

The duration to set.

setValueback to summary
public final void setValue(final String aValue)

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

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

Sets the current value of the property.

Parameters
aValue:String

a string representation of the property value

Annotations
@Override
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
net.fortuna.ical4j.model.property back to summary

public Class Duration.Factory

extends Factory
implements PropertyFactory<Duration>
Class Inheritance
All Implemented Interfaces
net.fortuna.ical4j.model.PropertyFactory, java.io.Serializable

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Duration
createProperty(final ParameterList
a list of property parameters
parameters
,
final String
a property value
value
)

Implements net.fortuna.ical4j.model.PropertyFactory.createProperty.

public Duration
Inherited from net.fortuna.ical4j.model.Content.Factory:
supports

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

Factoryback to summary
public Factory()

Method Detail

createPropertyback to summary
public Duration createProperty(final ParameterList parameters, final String value)

Implements net.fortuna.ical4j.model.PropertyFactory.createProperty.

Parameters
parameters:ParameterList

Doc from net.fortuna.ical4j.model.PropertyFactory.createProperty.

a list of property parameters

value:String

Doc from net.fortuna.ical4j.model.PropertyFactory.createProperty.

a property value

Returns:Duration

Doc from net.fortuna.ical4j.model.PropertyFactory.createProperty.

a new instance of the specified property

Annotations
@Override
createPropertyback to summary
public Duration createProperty()

Implements net.fortuna.ical4j.model.PropertyFactory.createProperty.

Returns:Duration

Doc from net.fortuna.ical4j.model.PropertyFactory.createProperty.

a new instance of the specified property

Annotations
@Override