C - Type of content that can be sent and received on this topic.public interface Topic<C>
A topic defines the type of content transported by the events.
| Modifier and Type | Method and Description |
|---|---|
default boolean |
covers(Topic<?> topic)
States whether this topic covers the specified topics.
|
default String |
getName()
Gets the name of the topic (or topic instance), mostly useful for logging/debugging purposes.
|
default Topic<? super C> |
getParentTopic()
Gets the parent topic if any.
|
default String getName()
By default, the class's simple name followed by the instance's hash code.
default Topic<? super C> getParentTopic()
A topic knows its parent, but a parent topic may or may not know their child topics depending on the implementation.
default boolean covers(Topic<?> topic)
A parent topic covers its child topics. Entities subscribing to a parent topic will receive messages for the parent topic and any of its child topics. For example, if an entity subscribes to event about the "Geography" topic, it will receive messages about "Geography" in general, but also about "France", about "The Netherlands", etc. However, an entity subscribing to events about the "France" topic, it will not receive messages about "Geography" in general or about "The Netherlands".
By default, a topic is covered by its parent topic; and a null topic is covered by nothing.
Note that the implementation should be consistent with getParentTopic().
topic - Topic to be checked (whether it is covered by this topic or not).getParentTopic()Copyright © 2017. All rights reserved.