Package org.jgrapes.core
Class NamedEvent<T>
java.lang.Object
org.jgrapes.core.internal.EventBase<T>
org.jgrapes.core.Event<T>
org.jgrapes.core.NamedEvent<T>
- All Implemented Interfaces:
Future<T>
,Associator
,Eligible
A class for events using a simple name as the event’s kind.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondata()
Returns a map with data that belongs to the event.Returns the kind of the event as the String passed to the constructor.boolean
isEligibleFor
(Object criterion) Returnstrue
if the criterion isEvent.class
(representing “any event”) or if the criterion is a String equal to this event’s kind (the String passed to the constructor).toString()
Methods inherited from class org.jgrapes.core.Event
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, forChannels, get, get, handled, handlingError, isCancelled, isDone, isStopped, processedBy, results, results, resumeHandling, setAssociated, setChannels, setRequiresResult, setResult, stop, suspendHandling, suspendHandling, tieTo
Methods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGet
Methods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
NamedEvent
Creates a new named event with the given name.- Parameters:
kind
- the event’s kind
-
-
Method Details
-
defaultCriterion
Returns the kind of the event as the String passed to the constructor.- Specified by:
defaultCriterion
in interfaceEligible
- Overrides:
defaultCriterion
in classEvent<T>
- Returns:
- the kind
- See Also:
-
isEligibleFor
Returnstrue
if the criterion isEvent.class
(representing “any event”) or if the criterion is a String equal to this event’s kind (the String passed to the constructor).- Specified by:
isEligibleFor
in interfaceEligible
- Overrides:
isEligibleFor
in classEvent<T>
- Parameters:
criterion
- the criterion- Returns:
- true if this meets the criterion
- See Also:
-
data
Returns a map with data that belongs to the event.The map is only created if requested. If a component uses
NamedEvent
s and data that consists of JDK types only, it is completely loosely coupled.- Returns:
- the map
-
toString
-