Top Description Fields Constructors Methods
net.fortuna.ical4j.model

public Class ComponentGroup<C extends Component>

extends Object
implements ComponentContainer<C extends Component>
Class Inheritance
All Implemented Interfaces
net.fortuna.ical4j.model.ComponentContainer, net.fortuna.ical4j.model.ComponentListAccessor
Imports
net.fortuna.ical4j.filter.predicate.PropertyEqualToRule, .PropertyExistsRule, net.fortuna.ical4j.model.property.RecurrenceId, .Uid, java.time.temporal.Temporal, java.util.*, java.util.function.Predicate, java.util.stream.Collectors

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.

Field Summary

Modifier and TypeField and Description
private ComponentList<C>
private final Predicate<C>

Constructor Summary

AccessConstructor and Description
public
ComponentGroup(Uid
the UID to filter on
uid
)

Construct a component group filtered on Uid.

public
ComponentGroup(Uid
the UID to filter on
uid
,
RecurrenceId<?> recurrenceId)

Construct a component group filtered on a specific recurrence of a Uid.

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

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

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

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

Method Summary

Modifier and TypeMethod and Description
public <T extends ComponentContainer<C>> T
add(C
the subcomponent to add
component
)

Overrides default net.fortuna.ical4j.model.ComponentContainer.add.

Add a subcomponent to this component.

public <T extends Temporal> List<Period<T>>
calculateRecurrenceSet(final Period<? extends Temporal> period)

Calculate all recurring periods for the specified date range.

public ComponentList<C>
public C
getLatestRevision()

Returns the latest component revision based on ascending sequence number and modified date.

public List<C>
getRevisions()

Apply filter to all components to create a subset containing components matching the specified UID.

public <T extends ComponentContainer<C>> T
replace(C
the subcomponent to add
component
)

Overrides default net.fortuna.ical4j.model.ComponentContainer.replace.

Add a subcomponent to this component whilst removing all other subcomponents with the same component name.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentListback to summary
private ComponentList<C> componentList
componentPredicateback to summary
private final Predicate<C> componentPredicate

Constructor Detail

ComponentGroupback to summary
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:Uid

the UID to filter on

ComponentGroupback to summary
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:Uid

the UID to filter on

ComponentGroupback to summary
public ComponentGroup(List<C> components, Uid uid)
ComponentGroupback to summary
public ComponentGroup(ComponentList<C> components, Uid uid)
ComponentGroupback to summary
public ComponentGroup(List<C> components, Uid uid, RecurrenceId<?> recurrenceId)
ComponentGroupback to summary
public ComponentGroup(ComponentList<C> components, Uid uid, RecurrenceId<?> recurrenceId)

Method Detail

addback to summary
public <T extends ComponentContainer<C>> T add(C component)

Overrides default net.fortuna.ical4j.model.ComponentContainer.add.

Doc from net.fortuna.ical4j.model.ComponentContainer.add.

Add a subcomponent to this component.

Parameters
component:C

the subcomponent to add

Returns:T

a reference to this component to support method chaining

Annotations
@Override
calculateRecurrenceSetback to summary
public <T extends Temporal> List<Period<T>> calculateRecurrenceSet(final 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.

See Also
Component#calculateRecurrenceSet(Period)
getComponentListback to summary
public ComponentList<C> getComponentList()

Implements net.fortuna.ical4j.model.ComponentListAccessor.getComponentList.

Annotations
@Override
getLatestRevisionback to summary
public C getLatestRevision()

Returns the latest component revision based on ascending sequence number and modified date.

getRevisionsback to summary
public List<C> getRevisions()

Apply filter to all components to create a subset containing components matching the specified UID.

replaceback to summary
public <T extends ComponentContainer<C>> T replace(C component)

Overrides default net.fortuna.ical4j.model.ComponentContainer.replace.

Doc from net.fortuna.ical4j.model.ComponentContainer.replace.

Add a subcomponent to this component whilst removing all other subcomponents with the same component name.

Parameters
component:C

the subcomponent to add

Returns:T

a reference to the component to support method chaining

Annotations
@Override
setComponentListback to summary
public void setComponentList(ComponentList<C> components)

Implements net.fortuna.ical4j.model.ComponentContainer.setComponentList.

Annotations
@Override