net.fortuna.ical4j.model.property

## Class Duration

- java.lang.Object
- - net.fortuna.ical4j.model.Content
  - - net.fortuna.ical4j.model.Property
    - - net.fortuna.ical4j.model.property.Duration

All Implemented Interfaces:
  Serializable

    public class Duration
    extends Property

$Id$ Created: [Apr 6, 2004] Defines a DURATION iCalendar component property.

         4.3.6   Duration

            Value Name: DURATION

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

            Formal Definition: The 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 character (US-ASCII decimal 44) separated list
            of values. The format is expressed as the [ISO 8601] basic format for
            the duration of time. The format can represent durations in terms of
            weeks, days, hours, minutes, and seconds.

            No additional content value encoding (i.e., BACKSLASH character
            encoding) 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
See Also:
  Serialized Form

### Field Summary

### Fields inherited from class net.fortuna.ical4j.model.Property

`ACTION, ATTACH, ATTENDEE, BUSYTYPE, 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, PERCENT_COMPLETE, POSTALCODE, PRIORITY, PRODID, RDATE, RECURRENCE_ID, REGION, RELATED_TO, REPEAT, REQUEST_STATUS, RESOURCES, RRULE, SEQUENCE, STATUS, STREET_ADDRESS, SUMMARY, TEL, TRANSP, TRIGGER, TZID, TZNAME, TZOFFSETFROM, TZOFFSETTO, TZURL, UID, URL, VERSION`

### Constructor Summary

Constructors
Constructor and Description
`Duration()` Default constructor.
`Duration(Date start, Date end)` Constructs a new duration representing the time between the specified start date and end date.
`Duration(Dur duration)`
`Duration(ParameterList aList, Dur duration)`
`Duration(ParameterList aList, String aValue)`

### Method Summary

Methods
`Dur` `getDuration()`
`String` `getValue()`
`void` `setDuration(Dur duration)`
`void` `setValue(String aValue)` Sets the current value of the property.
`void` `validate()` Perform validation on a property.

### Methods inherited from class net.fortuna.ical4j.model.Property

`copy, equals, getName, getParameter, getParameters, getParameters, hashCode, isCalendarProperty, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Duration

    public Duration()

Default constructor.

#### Duration

    public Duration(ParameterList aList,
            String aValue)

Parameters:
  `aList` - a list of parameters for this component
  `aValue` - a value string for this component

#### Duration

    public Duration(Dur duration)

Parameters:
  `duration` - a duration value

#### Duration

    public Duration(ParameterList aList,
            Dur duration)

Parameters:
  `aList` - a list of parameters for this component
  `duration` - a duration value

#### Duration

    public Duration(Date start,
            Date end)

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

Parameters:
  `start` - the starting time for the duration
  `end` - the end time for the duration

### Method Detail

#### getDuration

    public final Dur getDuration()

Returns:
  Returns the duration.

#### setValue

    public final void setValue(String aValue)

Sets the current value of the property.

Specified by:
  `setValue` in class `Property`
Parameters:
  `aValue` - a string representation of the property value

#### getValue

    public final String getValue()

Specified by:
  `getValue` in class `Content`
Returns:
  the content value

#### setDuration

    public final void setDuration(Dur duration)

Parameters:
  `duration` - The duration to set.

#### validate

    public final void validate()
                        throws ValidationException

Perform validation on a property.

Specified by:
  `validate` in class `Property`
Throws:
  `ValidationException` - where the property is not in a valid state