Class ElementsStrippingStage.Context

java.lang.Object
net.shibboleth.metadata.dom.SimpleDOMTraversalContext
net.shibboleth.metadata.dom.ElementsStrippingStage.Context
All Implemented Interfaces:
DOMTraversalContext
Enclosing class:
ElementsStrippingStage

@Immutable protected static final class ElementsStrippingStage.Context extends SimpleDOMTraversalContext
Context class for this kind of traversal.

An instance of this class is passed around during the traversal. To reduce the number of synchronizations, it includes a copy of each of the guarded state variables from the stage class instance.

  • Field Details

    • elements

      @Nonnull @NonnullElements private final List<Element> elements
      List of Elements to be removed from the document at the end of the traversal.
    • elementNamespace

      @Nonnull @NotEmpty private final String elementNamespace
      Namespace of the elements to strip.
    • elementNames

      @Nonnull @NonnullElements @Unmodifiable private final Collection<String> elementNames
      Names of the elements to strip.
    • keeping

      private final boolean keeping
      Whether we are keeping or removing elements (false by default, implying removing).
  • Constructor Details

    • Context

      public Context(@Nonnull Item<Element> contextItem, @Nonnull @NotEmpty String namespace, @Nonnull @NonnullElements @Unmodifiable Collection<String> names, boolean keep)
      Constructor.
      Parameters:
      contextItem - the Item we are traversing
      namespace - XML namespace for each of the elements to handle
      names - collection of element names within the namespace
      keep - whether the named elements should be removed (false) or preserved (true)
  • Method Details

    • getElementNamespace

      @Nonnull protected final String getElementNamespace()
      Get the namespace of the elements to strip.
      Returns:
      namespace of the elements to strip
    • getElementNames

      protected final Collection<String> getElementNames()
      Get the names of the elements to strip.
      Returns:
      the names of the elements to strip
    • isKeeping

      protected final boolean isKeeping()
      Indicates whether we are keeping the designated elements.
      Returns:
      true if the designated elements are being kept
    • add

      protected void add(@Nonnull Element element)
      Add the given Element to the list for later removal.
      Parameters:
      element - the Element to be removed
    • end

      public void end()
      Description copied from interface: DOMTraversalContext
      Perform any clean-up or final operations for the traversal. Called at the end of the traversal, may be overridden by subclasses.
      Specified by:
      end in interface DOMTraversalContext
      Overrides:
      end in class SimpleDOMTraversalContext