Class Tagger

  • Direct Known Subclasses:
    NoopTags.NoopTagger, TaggerImpl

    public abstract class Tagger
    extends java.lang.Object
    Object for creating new TagContexts and TagContexts based on the current context.

    This class returns builders that can be used to create the implementation-dependent TagContexts.

    Implementations may have different constraints and are free to convert tag contexts to their own subtypes. This means callers cannot assume the current context is the same instance as the one placed into scope.

    Since:
    0.8
    • Constructor Detail

      • Tagger

        public Tagger()
    • Method Detail

      • empty

        public abstract TagContext empty()
        Returns an empty TagContext.
        Returns:
        an empty TagContext.
        Since:
        0.8
      • getCurrentTagContext

        public abstract TagContext getCurrentTagContext()
        Returns the current TagContext.
        Returns:
        the current TagContext.
        Since:
        0.8
      • emptyBuilder

        public abstract TagContextBuilder emptyBuilder()
        Returns a new empty Builder.
        Returns:
        a new empty Builder.
        Since:
        0.8
      • toBuilder

        public abstract TagContextBuilder toBuilder​(TagContext tags)
        Returns a builder based on this TagContext.
        Returns:
        a builder based on this TagContext.
        Since:
        0.8
      • currentBuilder

        public abstract TagContextBuilder currentBuilder()
        Returns a new builder created from the current TagContext.
        Returns:
        a new builder created from the current TagContext.
        Since:
        0.8
      • withTagContext

        public abstract Scope withTagContext​(TagContext tags)
        Enters the scope of code where the given TagContext is in the current context (replacing the previous TagContext) and returns an object that represents that scope. The scope is exited when the returned object is closed.
        Parameters:
        tags - the TagContext to be set to the current context.
        Returns:
        an object that defines a scope where the given TagContext is set to the current context.
        Since:
        0.8