Interface TopicSelector

All Known Subinterfaces:
TopicPathSelector

public interface TopicSelector
A 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.

Selectors may be created using TopicSelectors.
Since:
5.0
Author:
DiffusionData Limited
See Also:
  • Field Details

  • Method Details

    • 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 for PATH, SPLIT_PATH_PATTERN, FULL_PATH_PATTERN, and SELECTOR_SET selectors. Expressions for these types of selectors can be re-parsed, and selector.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. For SPLIT_PATH_PATTERN or FULL_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_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

      boolean selects(String topicPath)
      Evaluate this selector against a topic path.
      Parameters:
      topicPath - The topic path.
      Returns:
      true If this selector selects topicPath.