Interface MqttTopic

All Superinterfaces:
Comparable<MqttUtf8String>, MqttUtf8String

@DoNotImplement public interface MqttTopic extends MqttUtf8String
MQTT Topic Name according to the MQTT specification.

A Topic Name has the same requirements as an UTF-8 encoded string. Additionally it

  • must be at least 1 character long and
  • must not contain wildcard characters ('#', '+').
Since:
1.0
  • Field Details

    • TOPIC_LEVEL_SEPARATOR

      static final char TOPIC_LEVEL_SEPARATOR
      The topic level separator character.
      See Also:
  • Method Details

    • of

      @NotNull static @NotNull MqttTopic of(@NotNull @NotNull String string)
      Validates and creates a Topic Name of the given string.
      Parameters:
      string - the string representation of the Topic Name.
      Returns:
      the created Topic Name.
      Throws:
      IllegalArgumentException - if the string is not a valid Topic Name.
    • builder

      @NotNull static @NotNull MqttTopicBuilder builder()
      Creates a builder for a Topic Name.
      Returns:
      the created builder.
    • getLevels

      @NotNull @Immutable @NotNull List<@NotNull String> getLevels()
      Returns:
      the levels of this Topic Name.
    • filter

      @NotNull @NotNull MqttTopicFilter filter()
      Returns:
      a Topic Filter matching only this Topic Name.
    • extend

      @NotNull MqttTopicBuilder.Complete extend()
      Creates a builder for extending this Topic Name.
      Returns:
      the created builder.