Interface TopicSelector
- All Known Subinterfaces:
TopicPathSelector
TopicSelector
is a value that identifies one or more topics.
Depending on where it is used, a selector may be evaluated by either the
server or the client library. For example, the server evaluates the selector
used to subscribe to a topic. In contrast, the selector used to register a
topic handler is evaluated by the client. Applications do not normally need
to evaluate selectors, but may do so using selects
.
A client may receive a selector providing the context for certain operations.
For example, to allow it to veto subscriptions. Limited ability to query the
selector's type
, associated expression
, and topic path
is provided.
Selectors may be compared using equals
.
Selectors of different types are never equal.
TopicSelectors
.- Since:
- 5.0
- Author:
- DiffusionData Limited
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
Prefix used forFULL_PATH_PATTERN
expressions.static final char
Prefix used forPATH
expressions.static final char
Prefix used forSET
expressions.static final char
Prefix used forSPLIT_PATH_PATTERN
expressions. -
Method Summary
Modifier and TypeMethodDescriptionThe expression associated with this selector.Get the topic path prefix from this selector pattern.getType()
The type of this selector.boolean
Evaluate this selector against a topic path.
-
Field Details
-
PATH_PREFIX
static final char PATH_PREFIXPrefix used forPATH
expressions.- See Also:
-
SPLIT_PATH_PATTERN_PREFIX
static final char SPLIT_PATH_PATTERN_PREFIXPrefix used forSPLIT_PATH_PATTERN
expressions.- See Also:
-
FULL_PATH_PATTERN_PREFIX
static final char FULL_PATH_PATTERN_PREFIXPrefix used forFULL_PATH_PATTERN
expressions.- See Also:
-
SELECTOR_SET_PREFIX
static final char SELECTOR_SET_PREFIXPrefix used forSET
expressions.- See Also:
-
-
Method Details
-
getType
TopicSelector.Type getType()The type of this selector.- Returns:
- The selector type.
-
getExpression
String getExpression()The expression associated with this selector.See
TopicSelectors.parse(String)
for the expression format forPATH
,SPLIT_PATH_PATTERN
,FULL_PATH_PATTERN
, andSELECTOR_SET
selectors. Expressions for these types of selectors can be re-parsed, andselector.equals(
Diffusion.topicSelectors().parse(selector.getExpression())
) == true
.- Returns:
- The expression.
-
getPathPrefix
String getPathPrefix()Get the topic path prefix from this selector pattern.Returns the largest fixed topic path that begins the selector expression. For
PATH
selectors, this is the entire path. ForSPLIT_PATH_PATTERN
orFULL_PATH_PATTERN
selectors, this is a topic path up to, but not including, the first part of the path that contains a regular expression.For
SELECTOR_SET
s, this method will return the largest prefix that is common to all included selectors.If there is no common prefix, an empty string will be returned.
- Returns:
- the topic path prefix
- Since:
- 5.1
-
selects
Evaluate this selector against a topic path.- Parameters:
topicPath
- The topic path.- Returns:
true
If this selector selectstopicPath
.
-