Class Topic

java.lang.Object
software.amazon.smithy.mqtt.traits.Topic

public final class Topic extends Object
Represents a parsed MQTT topic.
  • Method Details

    • parse

      public static Topic parse(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 List<Topic.Level> getLevels()
      Gets all of the hierarchical levels of the topic.
      Returns:
      Returns the topic levels.
    • getLabels

      public List<Topic.Level> getLabels()
      Gets all of the label levels in the topic.
      Returns:
      Returns the label levels.
    • hasLabel

      public boolean hasLabel(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 String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object