Package net.fortuna.ical4j.model
Class Component
- java.lang.Object
-
- net.fortuna.ical4j.model.Component
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Available,CalendarComponent,Observance
public abstract class Component extends Object implements Serializable
$Id$ [Apr 5, 2004] Defines an iCalendar component. Subclasses of this class provide additional validation and typed values for specific iCalendar components.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringAVAILABLEComponent token.static StringBEGINComponent start token.static StringENDComponent end token.static StringEXPERIMENTAL_PREFIXPrefix for non-standard components.static StringVALARMComponent token.static StringVAVAILABILITYComponent token.static StringVEVENTComponent token.static StringVFREEBUSYComponent token.static StringVJOURNALComponent token.static StringVTIMEZONEComponent token.static StringVTODOComponent token.static StringVVENUEComponent token.
-
Constructor Summary
Constructors Modifier Constructor Description protectedComponent(String s)Constructs a new component containing no properties.protectedComponent(String s, PropertyList<Property> p)Constructor made protected to enforce the use ofComponentFactoryfor component instantiation.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PeriodListcalculateRecurrenceSet(Period period)Calculates the recurrence set for this component using the specified period.Componentcopy()Create a (deep) copy of this component.booleanequals(Object arg0)StringgetName()PropertyList<Property>getProperties()<C extends Property>
PropertyList<C>getProperties(String name)Convenience method for retrieving a list of named properties.<T extends Property>
TgetProperty(String name)Convenience method for retrieving a named property.protected PropertygetRequiredProperty(String name)Convenience method for retrieving a required named property.inthashCode()StringtoString()voidvalidate()Perform validation on a component and its properties.abstract voidvalidate(boolean recurse)Perform validation on a component.protected voidvalidateProperties()Invoke validation on the component properties in its current state.
-
-
-
Field Detail
-
BEGIN
public static final String BEGIN
Component start token.- See Also:
- Constant Field Values
-
END
public static final String END
Component end token.- See Also:
- Constant Field Values
-
VEVENT
public static final String VEVENT
Component token.- See Also:
- Constant Field Values
-
VTODO
public static final String VTODO
Component token.- See Also:
- Constant Field Values
-
VJOURNAL
public static final String VJOURNAL
Component token.- See Also:
- Constant Field Values
-
VFREEBUSY
public static final String VFREEBUSY
Component token.- See Also:
- Constant Field Values
-
VTIMEZONE
public static final String VTIMEZONE
Component token.- See Also:
- Constant Field Values
-
VALARM
public static final String VALARM
Component token.- See Also:
- Constant Field Values
-
VAVAILABILITY
public static final String VAVAILABILITY
Component token.- See Also:
- Constant Field Values
-
VVENUE
public static final String VVENUE
Component token.- See Also:
- Constant Field Values
-
AVAILABLE
public static final String AVAILABLE
Component token.- See Also:
- Constant Field Values
-
EXPERIMENTAL_PREFIX
public static final String EXPERIMENTAL_PREFIX
Prefix for non-standard components.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Component
protected Component(String s)
Constructs a new component containing no properties.- Parameters:
s- a component name
-
Component
protected Component(String s, PropertyList<Property> p)
Constructor made protected to enforce the use ofComponentFactoryfor component instantiation.- Parameters:
s- component namep- a list of properties
-
-
Method Detail
-
getName
public final String getName()
- Returns:
- Returns the name.
-
getProperties
public final PropertyList<Property> getProperties()
- Returns:
- Returns the properties.
-
getProperties
public final <C extends Property> PropertyList<C> getProperties(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 <T extends Property> T getProperty(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
-
getRequiredProperty
protected final Property getRequiredProperty(String name) throws ConstraintViolationException
Convenience method for retrieving a required named property.- Parameters:
name- name of the property to retrieve- Returns:
- the first matching property in the property list with the specified name
- Throws:
ConstraintViolationException- when a property is not found
-
validate
public final void validate() throws ValidationExceptionPerform 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 ValidationExceptionPerform 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 ValidationExceptionInvoke validation on the component properties in its current state.- Throws:
ValidationException- where any of the component properties is not in a valid state
-
copy
public Component copy() throws ParseException, IOException, URISyntaxException
Create a (deep) copy of this component.- Returns:
- the component copy
- Throws:
IOException- where an error occurs reading the component dataParseException- where parsing component data failsURISyntaxException- 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
-
-