Class Topic


  • public final class Topic
    extends java.lang.Object
    Represents a parsed MQTT topic.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Topic.Level
      Represents a level in a topic.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean conflictsWith​(Topic other)
      Determines if this topic conflicts with another topic.
      boolean equals​(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.
      int hashCode()  
      boolean hasLabel​(java.lang.String label)
      Returns true if the topic contains the given label string.
      static Topic parse​(java.lang.String topic)
      Parses an MQTT topic and labels.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object