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
Constructors -
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.booleanisEligibleFor(Object criterion) Returnstrueif 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, tieToMethods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGetMethods 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:
defaultCriterionin interfaceEligible- Overrides:
defaultCriterionin classEvent<T>- Returns:
- the kind
- See Also:
-
isEligibleFor
Returnstrueif 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:
isEligibleForin interfaceEligible- Overrides:
isEligibleForin 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
NamedEvents and data that consists of JDK types only, it is completely loosely coupled.- Returns:
- the map
-
toString
-