net.fortuna.ical4j.model
Class Component

java.lang.Object
  extended by net.fortuna.ical4j.model.Component
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Available, CalendarComponent, Observance

public abstract class Component
extends java.lang.Object
implements java.io.Serializable

$Id: Component.java,v 1.36 2011/02/20 03:12:32 fortuna Exp $ [Apr 5, 2004] Defines an iCalendar component. Subclasses of this class provide additional validation and typed values for specific iCalendar components.

Author:
Ben Fortuna
See Also:
Serialized Form

Field Summary
static java.lang.String AVAILABLE
          Component token.
static java.lang.String BEGIN
          Component start token.
static java.lang.String END
          Component end token.
static java.lang.String EXPERIMENTAL_PREFIX
          Prefix for non-standard components.
static java.lang.String VALARM
          Component token.
static java.lang.String VAVAILABILITY
          Component token.
static java.lang.String VEVENT
          Component token.
static java.lang.String VFREEBUSY
          Component token.
static java.lang.String VJOURNAL
          Component token.
static java.lang.String VTIMEZONE
          Component token.
static java.lang.String VTODO
          Component token.
static java.lang.String VVENUE
          Component token.
 
Constructor Summary
protected Component(java.lang.String s)
          Constructs a new component containing no properties.
protected Component(java.lang.String s, PropertyList p)
          Constructor made protected to enforce the use of ComponentFactory for component instantiation.
 
Method Summary
 PeriodList calculateRecurrenceSet(Period period)
          Calculates the recurrence set for this component using the specified period.
 Component copy()
          Create a (deep) copy of this component.
 boolean equals(java.lang.Object arg0)
          
 java.lang.String getName()
           
 PropertyList getProperties()
           
 PropertyList getProperties(java.lang.String name)
          Convenience method for retrieving a list of named properties.
 Property getProperty(java.lang.String name)
          Convenience method for retrieving a named property.
 int hashCode()
          
 java.lang.String toString()
          
 void validate()
          Perform validation on a component and its properties.
abstract  void validate(boolean recurse)
          Perform validation on a component.
protected  void validateProperties()
          Invoke validation on the component properties in its current state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BEGIN

public static final java.lang.String BEGIN
Component start token.

See Also:
Constant Field Values

END

public static final java.lang.String END
Component end token.

See Also:
Constant Field Values

VEVENT

public static final java.lang.String VEVENT
Component token.

See Also:
Constant Field Values

VTODO

public static final java.lang.String VTODO
Component token.

See Also:
Constant Field Values

VJOURNAL

public static final java.lang.String VJOURNAL
Component token.

See Also:
Constant Field Values

VFREEBUSY

public static final java.lang.String VFREEBUSY
Component token.

See Also:
Constant Field Values

VTIMEZONE

public static final java.lang.String VTIMEZONE
Component token.

See Also:
Constant Field Values

VALARM

public static final java.lang.String VALARM
Component token.

See Also:
Constant Field Values

VAVAILABILITY

public static final java.lang.String VAVAILABILITY
Component token.

See Also:
Constant Field Values

VVENUE

public static final java.lang.String VVENUE
Component token.

See Also:
Constant Field Values

AVAILABLE

public static final java.lang.String AVAILABLE
Component token.

See Also:
Constant Field Values

EXPERIMENTAL_PREFIX

public static final java.lang.String EXPERIMENTAL_PREFIX
Prefix for non-standard components.

See Also:
Constant Field Values
Constructor Detail

Component

protected Component(java.lang.String s)
Constructs a new component containing no properties.

Parameters:
s - a component name

Component

protected Component(java.lang.String s,
                    PropertyList p)
Constructor made protected to enforce the use of ComponentFactory for component instantiation.

Parameters:
s - component name
p - a list of properties
Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getName

public final java.lang.String getName()
Returns:
Returns the name.

getProperties

public final PropertyList getProperties()
Returns:
Returns the properties.

getProperties

public final PropertyList getProperties(java.lang.String name)
Convenience method for retrieving a list of named properties.

Parameters:
name - name of properties to retrieve
Returns:
a property list containing only properties with the specified name

getProperty

public final Property getProperty(java.lang.String name)
Convenience method for retrieving a named property.

Parameters:
name - name of the property to retrieve
Returns:
the first matching property in the property list with the specified name

validate

public final void validate()
                    throws ValidationException
Perform validation on a component and its properties.

Throws:
ValidationException - where the component is not in a valid state

validate

public abstract void validate(boolean recurse)
                       throws ValidationException
Perform validation on a component.

Parameters:
recurse - indicates whether to validate the component's properties
Throws:
ValidationException - where the component is not in a valid state

validateProperties

protected final void validateProperties()
                                 throws ValidationException
Invoke validation on the component properties in its current state.

Throws:
ValidationException - where any of the component properties is not in a valid state

equals

public boolean equals(java.lang.Object arg0)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

copy

public Component copy()
               throws java.text.ParseException,
                      java.io.IOException,
                      java.net.URISyntaxException
Create a (deep) copy of this component.

Returns:
the component copy
Throws:
java.io.IOException - where an error occurs reading the component data
java.text.ParseException - where parsing component data fails
java.net.URISyntaxException - where component data contains an invalid URI

calculateRecurrenceSet

public final PeriodList calculateRecurrenceSet(Period period)
Calculates the recurrence set for this component using the specified period. The recurrence set is derived from a combination of the component start date, recurrence rules and dates, and exception rules and dates. Note that component transparency and anniversary-style dates do not affect the resulting intersection.

If an explicit DURATION is not specified, the effective duration of each returned period is derived from the DTSTART and DTEND or DUE properties. If the component has no DURATION, DTEND or DUE, the effective duration is set to PT0S

Parameters:
period - a range to calculate recurrences for
Returns:
a list of periods


Copyright © 2004-2011 Modularity. All Rights Reserved.