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
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charPrefix used forFULL_PATH_PATTERNexpressions.static final charPrefix used forPATHexpressions.static final charPrefix used forSETexpressions.static final charPrefix used forSPLIT_PATH_PATTERNexpressions. -
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.booleanEvaluate this selector against a topic path.
-
Field Details
-
PATH_PREFIX
static final char PATH_PREFIXPrefix used forPATHexpressions.- See Also:
-
SPLIT_PATH_PATTERN_PREFIX
static final char SPLIT_PATH_PATTERN_PREFIXPrefix used forSPLIT_PATH_PATTERNexpressions.- See Also:
-
FULL_PATH_PATTERN_PREFIX
static final char FULL_PATH_PATTERN_PREFIXPrefix used forFULL_PATH_PATTERNexpressions.- See Also:
-
SELECTOR_SET_PREFIX
static final char SELECTOR_SET_PREFIXPrefix used forSETexpressions.- 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_SETselectors. 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
PATHselectors, this is the entire path. ForSPLIT_PATH_PATTERNorFULL_PATH_PATTERNselectors, this is a topic path up to, but not including, the first part of the path that contains a regular expression.For
SELECTOR_SETs, 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:
trueIf this selector selectstopicPath.
-