public final class TopicBinding<T extends Trait>
extends java.lang.Object
Smithy models can contain a number of MQTT topics that are formed by
the publish
and subscribe
traits. Each of these
traits resolves to a single MQTT topic.
This class abstracts away the process of computing the payload of an MQTT operation. Each topic binding provides the following information:
@smithy.mqtt#publish
resolve to a single topic that
is defined by topic property of the trait.
subscribe
resolve to a single topic
that is defined by the topic property of the trait.
subscribe
operations where an event member is marked with the eventPayload
trait.Modifier and Type | Method and Description |
---|---|
boolean |
conflictsWith(TopicBinding<?> other)
Returns true if the topic binding conflicts with another.
|
boolean |
equals(java.lang.Object o) |
java.util.Optional<StructureShape> |
getInput()
Deprecated.
Use getInputShape instead.
|
StructureShape |
getInputShape()
Gets the input shape related to this operation.
|
T |
getMqttTrait()
Gets the trait that formed the binding of the operation to MQTT
for this topic.
|
OperationShape |
getOperation()
Gets the operation shape related to the topic bindings.
|
static java.util.Optional<? extends Trait> |
getOperationMqttTrait(Shape operation)
Finds the MQTT binding trait associated with an operation.
|
java.util.Optional<Shape> |
getPayloadShape()
Gets the payload shape of the topic.
|
Topic |
getTopic()
Gets the resolved topic of the binding.
|
int |
hashCode() |
java.lang.String |
toString() |
public static java.util.Optional<? extends Trait> getOperationMqttTrait(Shape operation)
operation
- Operation to check.public T getMqttTrait()
The provided trait will be either an instance of
PublishTrait
or SubscribeTrait
.
public OperationShape getOperation()
public Topic getTopic()
@Deprecated public java.util.Optional<StructureShape> getInput()
public StructureShape getInputShape()
public java.util.Optional<Shape> getPayloadShape()
The payload shape is either a structure for a single-event event stream, or a union for a multi-event event stream.
public boolean conflictsWith(TopicBinding<?> other)
A topic binding is considered conflicting if both bindings have
conflicting topics determined through Topic.conflictsWith(software.amazon.smithy.mqtt.traits.Topic)
and the topic bindings utilize a different payload. If both topics
do not have a payload then they are not conflicting. If both topics
have a payload, but they target the same shape, then they are not
conflicting.
other
- Other topic binding to compare against.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object