public final class QueryableBroadcaster extends AbstractBroadcaster
This can handle finding broadcasts of all types, but prefer to use one of the TypeInterestBroadcaster
s if you're
only interested in a single type.
next
Constructor and Description |
---|
QueryableBroadcaster()
Creates a new
QueryableBroadcaster . |
QueryableBroadcaster(Broadcaster broadcaster)
Creates a new
QueryableBroadcaster and calls AbstractBroadcaster.chain(Broadcaster) on this instance, passing in the
given Broadcaster . |
Modifier and Type | Method and Description |
---|---|
List<Broadcastable> |
all()
Retrieves all broadcasted events.
|
void |
broadcast(Broadcastable broadcastable)
Broadcasts the given event (syntax unit).
|
int |
count()
Gets the total number of broadcasted units.
|
<T extends Broadcastable> |
filter(Class<T> klass)
Gets all broadcasted events that are instances of the given class.
|
<T extends Broadcastable> |
find(Class<T> klass)
Finds the first
Broadcastable unit that is an instance of the given class. |
boolean |
hasAny()
Returns true if any events were received by this broadcaster.
|
chain, chainBroadcast, cut, relay
public QueryableBroadcaster()
QueryableBroadcaster
.public QueryableBroadcaster(Broadcaster broadcaster)
QueryableBroadcaster
and calls AbstractBroadcaster.chain(Broadcaster)
on this instance, passing in the
given Broadcaster
.broadcaster
- Add this broadcaster to the end of the chain.public void broadcast(Broadcastable broadcastable)
Broadcaster
broadcastable
- The Broadcastable
syntax unit.public <T extends Broadcastable> Iterable<T> filter(Class<T> klass)
T
- Type of the Broadcastable
unit.klass
- Filter Broadcastable
units that are instances of this class.Broadcastable
units that are instances of the given class.public <T extends Broadcastable> Optional<T> find(Class<T> klass)
Broadcastable
unit that is an instance of the given class.T
- Type of the Broadcastable
unit.klass
- Get the first Broadcastable
unit that is an instance of this class.Broadcastable
unit that is an instance of the given class.public boolean hasAny()
public List<Broadcastable> all()
public int count()
Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.