Package com.hivemq.client.mqtt.datatypes
Interface MqttTopicFilter
- All Superinterfaces:
Comparable<MqttUtf8String>,MqttUtf8String
- All Known Subinterfaces:
MqttSharedTopicFilter
MQTT Topic Filter according to the MQTT specification.
A Topic Filter has the same requirements as an UTF-8 encoded string. Additionally it
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe multi-level wildcard character.static final charThe single-level wildcard character. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull MqttTopicFilterBuilderbuilder()Creates a builder for a Topic Filter.booleanbooleanbooleanextend()Creates a builder for extending this Topic Filter.booleanisShared()booleanMatches this Topic Filter with the given Topic Name.booleanmatches(@NotNull MqttTopicFilter topicFilter) Matches this Topic Filter with the given Topic Filter.static @NotNull MqttTopicFilterValidates and creates a Topic Filter of the given string.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.hivemq.client.mqtt.datatypes.MqttUtf8String
containsShouldNotCharacters, toByteBuffer
-
Field Details
-
MULTI_LEVEL_WILDCARD
static final char MULTI_LEVEL_WILDCARDThe multi-level wildcard character.- See Also:
-
SINGLE_LEVEL_WILDCARD
static final char SINGLE_LEVEL_WILDCARDThe single-level wildcard character.- See Also:
-
-
Method Details
-
of
Validates and creates a Topic Filter of the given string.- Parameters:
string- the string representation of the Topic Filter.- Returns:
- the created Topic Filter.
- Throws:
IllegalArgumentException- if the string is not a valid Topic Filter.
-
builder
Creates a builder for a Topic Filter.- Returns:
- the created builder.
-
getLevels
- Returns:
- the levels of this Topic Filter.
-
containsWildcards
boolean containsWildcards()- Returns:
- whether this Topic Filter contains wildcards.
-
containsMultiLevelWildcard
boolean containsMultiLevelWildcard()- Returns:
- whether this Topic Filter contains a multi-level wildcard.
-
containsSingleLevelWildcard
boolean containsSingleLevelWildcard()- Returns:
- whether this Topic Filter contains one ore more single-level wildcards.
-
matches
Matches this Topic Filter with the given Topic Name.- Parameters:
topic- the Topic Name to match.- Returns:
- true if this Topic Filter matches the Topic Name, otherwise false.
-
matches
Matches this Topic Filter with the given Topic Filter.- Parameters:
topicFilter- the Topic Filter to match.- Returns:
- true if this Topic Filter matches the given Topic Filter, otherwise false.
-
extend
@NotNull MqttTopicFilterBuilder.Complete extend()Creates a builder for extending this Topic Filter.- Returns:
- the created builder.
-