Module ical4j.core

Class Component

java.lang.Object
net.fortuna.ical4j.model.Content
net.fortuna.ical4j.model.Component
All Implemented Interfaces:
Serializable, Comparable<Component>, FluentComponent, PropertyContainer, PropertyListAccessor, Prototype<Component>
Direct Known Subclasses:
Available, CalendarComponent, Observance, Participant, VAlarm, VLocation, VResource

public abstract class Component extends Content implements Prototype<Component>, Serializable, PropertyContainer, FluentComponent, Comparable<Component>
$Id$ [Apr 5, 2004]

Defines an iCalendar component. Subclasses of this class provide additional validation and typed values for specific iCalendar components.

See Also:
  • Field Details

  • Constructor Details

    • Component

      protected Component(String s)
      Constructs a new component containing no properties.
      Parameters:
      s - a component name
    • Component

      protected Component(String s, PropertyList p)
    • Component

      protected Component(String s, PropertyList p, ComponentList<? extends Component> c)
      Constructor made protected to enforce the use of ComponentFactory for component instantiation.
      Parameters:
      s - component name
      p - a list of properties
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public final String getName()
      Specified by:
      getName in class Content
      Returns:
      Returns the name.
    • getValue

      public String getValue()
      Specified by:
      getValue in class Content
      Returns:
      the content value
    • getProperties

      public <T extends Property> List<T> getProperties()
    • getFluentTarget

      public Component getFluentTarget()
      Specified by:
      getFluentTarget in interface FluentComponent
    • getPropertyList

      public final PropertyList getPropertyList()
      Specified by:
      getPropertyList in interface PropertyListAccessor
      Returns:
      Returns the underlying property list.
    • setPropertyList

      public void setPropertyList(PropertyList properties)
      Specified by:
      setPropertyList in interface PropertyContainer
    • getUid

      public Optional<Uid> getUid()
      Returns the UID property of this component if available.
      Returns:
      a Uid instance, or null if no UID property exists
    • validate

      public ValidationResult 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 ValidationResult 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 ValidationResult 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(Object arg0)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • newFactory

      protected abstract ComponentFactory<? extends Component> newFactory()
      Returns a new component factory used to create deep copies.
      Returns:
      a component factory instance
    • copy

      public Component copy()
      Create a (deep) copy of this component.
      Specified by:
      copy in interface Prototype<Component>
      Returns:
      the component copy
    • calculateRecurrenceSet

      public final <T extends Temporal> Set<Period<T>> calculateRecurrenceSet(Period<? extends Temporal> 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

      NOTE: As a component may be defined in terms of floating date-time values (i.e. without a specific timezone), when calculating a recurrence set we must explicitly provide an applicable timezone for calculations.
      Parameters:
      period - a range that defines the boundary for calculations
      Returns:
      a list of periods representing component occurrences within the specified boundary
    • compareTo

      public int compareTo(Component o)
      Specified by:
      compareTo in interface Comparable<Component>