Module ical4j.core

Class ComponentGroup<C extends Component>

java.lang.Object
net.fortuna.ical4j.model.ComponentGroup<C>
All Implemented Interfaces:
ComponentContainer<C>, ComponentListAccessor<C>

public class ComponentGroup<C extends Component> extends Object implements ComponentContainer<C>
Support for operations applicable to a group of components. Typically, this class is used to manage component revisions (whereby each revision is a separate component), and the resulting output of such group functions. Example - Find the latest revision of an event:
     Calendar calendar = ...
     String uidString = ...

     ComponentGroup group = new ComponentGroup(
          calendar.getComponents(Component.VEVENT),
          new Uid(uidString));

     return group.getLatestRevision();
 
Created by fortuna on 20/07/2017.
  • Constructor Details

    • ComponentGroup

      public ComponentGroup(Uid uid)
      Construct a component group filtered on Uid. Note that this will exclude any recurrence instances as specified by the presence of a RecurrenceId property.
      Parameters:
      uid - the UID to filter on
    • ComponentGroup

      public ComponentGroup(Uid uid, RecurrenceId<?> recurrenceId)
      Construct a component group filtered on a specific recurrence of a Uid. Note that this will only include revisions of a single recurrence instance as specified by the RecurrenceId property.
      Parameters:
      uid - the UID to filter on
    • ComponentGroup

      public ComponentGroup(List<C> components, Uid uid)
    • ComponentGroup

      public ComponentGroup(ComponentList<C> components, Uid uid)
    • ComponentGroup

      public ComponentGroup(List<C> components, Uid uid, RecurrenceId<?> recurrenceId)
    • ComponentGroup

      public ComponentGroup(ComponentList<C> components, Uid uid, RecurrenceId<?> recurrenceId)
  • Method Details

    • getComponentList

      public ComponentList<C> getComponentList()
      Specified by:
      getComponentList in interface ComponentListAccessor<C extends Component>
    • setComponentList

      public void setComponentList(ComponentList<C> components)
      Specified by:
      setComponentList in interface ComponentContainer<C extends Component>
    • add

      public <T extends ComponentContainer<C>> T add(C component)
      Description copied from interface: ComponentContainer
      Add a subcomponent to this component.
      Specified by:
      add in interface ComponentContainer<C extends Component>
      Parameters:
      component - the subcomponent to add
      Returns:
      a reference to this component to support method chaining
    • replace

      public <T extends ComponentContainer<C>> T replace(C component)
      Description copied from interface: ComponentContainer
      Add a subcomponent to this component whilst removing all other subcomponents with the same component name.
      Specified by:
      replace in interface ComponentContainer<C extends Component>
      Parameters:
      component - the subcomponent to add
      Returns:
      a reference to the component to support method chaining
    • getRevisions

      public List<C> getRevisions()
      Apply filter to all components to create a subset containing components matching the specified UID.
      Returns:
    • getLatestRevision

      public C getLatestRevision()
      Returns the latest component revision based on ascending sequence number and modified date.
      Returns:
    • calculateRecurrenceSet

      public <T extends Temporal> List<Period<T>> calculateRecurrenceSet(Period<? extends Temporal> period)
      Calculate all recurring periods for the specified date range. This method will take all revisions into account when generating the set. Component revisions with a RECURRENCE_ID property are processed last, as they override instances in the default recurrence set.
      Parameters:
      period -
      Returns:
      See Also: