Package net.shibboleth.metadata.dom
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final Collection<String>Names of the elements to strip.private final StringNamespace of the elements to strip.List ofElements to be removed from the document at the end of the traversal.private final booleanWhether we are keeping or removing elements (falseby default, implying removing). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd the givenElementto the list for later removal.voidend()Perform any clean-up or final operations for the traversal.protected final Collection<String>Get the names of the elements to strip.protected final StringGet the namespace of the elements to strip.protected final booleanIndicates whether we are keeping the designated elements.Methods inherited from class net.shibboleth.metadata.dom.SimpleDOMTraversalContext
getItem
-
Field Details
-
elements
List ofElements to be removed from the document at the end of the traversal. -
elementNamespace
Namespace of the elements to strip. -
elementNames
Names of the elements to strip. -
keeping
private final boolean keepingWhether we are keeping or removing elements (falseby 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- theItemwe are traversingnamespace- XML namespace for each of the elements to handlenames- collection of element names within the namespacekeep- whether the named elements should be removed (false) or preserved (true)
-
-
Method Details
-
getElementNamespace
Get the namespace of the elements to strip.- Returns:
- namespace of the elements to strip
-
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:
trueif the designated elements are being kept
-
add
Add the givenElementto the list for later removal.- Parameters:
element- theElementto be removed
-
end
public void end()Description copied from interface:DOMTraversalContextPerform any clean-up or final operations for the traversal. Called at the end of the traversal, may be overridden by subclasses.- Specified by:
endin interfaceDOMTraversalContext- Overrides:
endin classSimpleDOMTraversalContext
-