Class Topic
- java.lang.Object
-
- software.amazon.smithy.mqtt.traits.Topic
-
public final class Topic extends java.lang.ObjectRepresents a parsed MQTT topic.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTopic.LevelRepresents a level in a topic.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconflictsWith(Topic other)Determines if this topic conflicts with another topic.booleanequals(java.lang.Object o)java.util.List<Topic.Level>getLabels()Gets all of the label levels in the topic.java.util.List<Topic.Level>getLevels()Gets all of the hierarchical levels of the topic.inthashCode()booleanhasLabel(java.lang.String label)Returns true if the topic contains the given label string.static Topicparse(java.lang.String topic)Parses an MQTT topic and labels.java.lang.StringtoString()
-
-
-
Method Detail
-
parse
public static Topic parse(java.lang.String topic)
Parses an MQTT topic and labels.- Parameters:
topic- Topic to parse.- Returns:
- Returns the parsed topic.
- Throws:
TopicSyntaxException- if the topic is malformed.
-
getLevels
public java.util.List<Topic.Level> getLevels()
Gets all of the hierarchical levels of the topic.- Returns:
- Returns the topic levels.
-
getLabels
public java.util.List<Topic.Level> getLabels()
Gets all of the label levels in the topic.- Returns:
- Returns the label levels.
-
hasLabel
public boolean hasLabel(java.lang.String label)
Returns true if the topic contains the given label string.- Parameters:
label- Label to check for.- Returns:
- Returns true if the label exists in the topic.
-
conflictsWith
public boolean conflictsWith(Topic other)
Determines if this topic conflicts with another topic.- Parameters:
other- Topic to check against.- Returns:
- Returns true if there is a conflict.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-