Package org.xwiki.eventstream
Class EventGroup
- java.lang.Object
-
- org.xwiki.eventstream.EventGroup
-
public class EventGroup extends Object
A group of related events, all happening as a consequence of the same action.- Since:
- 3.0M2
- Version:
- $Id: 05fdc0f8424d70eefc6246887099801b586cc1c6 $
-
-
Constructor Summary
Constructors Constructor Description EventGroup()
Default constructor that creates an empty event group.EventGroup(List<Event> events)
Constructor that creates a group containing the passed events.EventGroup(Set<Event> events)
Constructor that creates a group containing the passed events.EventGroup(Event... events)
Constructor that creates a group containing the passed events.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEvents(Event... events)
Add more events to this group.void
clearEvents()
Remove all the events from this group.Set<Event>
getEvents()
List the events that are part of this group.Event
getMainEvent()
Get the most important event in this group.String
toString()
-
-
-
Constructor Detail
-
EventGroup
public EventGroup()
Default constructor that creates an empty event group.
-
EventGroup
public EventGroup(List<Event> events)
Constructor that creates a group containing the passed events.- Parameters:
events
- the list of initial events to put in the group
-
EventGroup
public EventGroup(Set<Event> events)
Constructor that creates a group containing the passed events.- Parameters:
events
- the list of initial events to put in the group
-
EventGroup
public EventGroup(Event... events)
Constructor that creates a group containing the passed events.- Parameters:
events
- the list of initial events to put in the group
-
-
Method Detail
-
getEvents
public Set<Event> getEvents()
List the events that are part of this group.- Returns:
- a read only snapshot of the events in this group; future changes in this group will not be reflected in the returned snapshot
-
addEvents
public void addEvents(Event... events)
Add more events to this group. Duplicate events are added only once, since this is aSet
.- Parameters:
events
- the new events to add
-
clearEvents
public void clearEvents()
Remove all the events from this group.
-
getMainEvent
public Event getMainEvent()
Get the most important event in this group. The "importance" is given by theimportance
property of events. If more events have the same maximal importance, the first one found in the group is returned. Usually this corresponds to the order the events were created, but this is not a guaranteed property.- Returns:
- the most important event found in this group,
null
if the group is empty.
-
-