Class AbstractAttributeValidationStage<T>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
Type Parameters:
T - type to convert each attribute to for validation
All Implemented Interfaces:
Stage<Element>, net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.IdentifiableComponent, net.shibboleth.shared.component.IdentifiedComponent, net.shibboleth.shared.component.InitializableComponent
Direct Known Subclasses:
StringAttributeValidationStage

public abstract class AbstractAttributeValidationStage<T> extends AbstractElementVisitingValidationStage<T,Attr>
Abstract base class allowing a selected subset of XML attributes in a DOM document to be validated as a given type.
Since:
0.10.0
  • Field Details

    • attributeNames

      @NonnullElements @Unmodifiable @Nonnull private Set<QName> attributeNames
      Collection of attribute names for those attributes we will be visiting.

      Internally, this is always held as a Set of QNames, and that's how it will be returned by the getter. There are four setters, however, for both collections and singletons, and both simple attribute names and qualified names (@link QName}s).

      Because of type erasure, those setters can't all be overloads of the same method name, so the String-based unqualified name forms (which will by far dominate use cases) are given the preferred identifiers.

  • Constructor Details

    • AbstractAttributeValidationStage

      public AbstractAttributeValidationStage()
  • Method Details

    • getAttributeNames

      @Nonnull public final Collection<QName> getAttributeNames()
      Gets the collection of attribute names to visit.
      Returns:
      collection of attribute names to visit
    • setAttributeNames

      public final void setAttributeNames(@Nonnull Collection<String> names)
      Sets the collection of attribute names to visit, as a collection of unqualified String values.
      Parameters:
      names - collection of attribute names to visit
    • setAttributeName

      public final void setAttributeName(@Nonnull String name)
      Sets a single attribute name to be visited.

      Shorthand for use when a single unqualified attribute name, expressed as a String, is used.

      Parameters:
      name - name for the attribute to be visited
    • setQualifiedAttributeNames

      public final void setQualifiedAttributeNames(@Nonnull Collection<QName> names)
      Sets the collection of attribute names to visit.
      Parameters:
      names - collection of qualified attribute names to visit
    • setQualifiedAttributeName

      public final void setQualifiedAttributeName(@Nonnull QName name)
      Sets a single attribute name to be visited.
      Parameters:
      name - QName for the attribute to be visited
    • visit

      protected void visit(@Nonnull Element element, @Nonnull DOMTraversalContext context) throws StageProcessingException
      Description copied from class: AbstractDOMTraversalStage
      Visit a particular Element.
      Specified by:
      visit in class AbstractDOMTraversalStage<DOMTraversalContext>
      Parameters:
      element - the Element to visit
      context - the traversal context
      Throws:
      StageProcessingException - if errors occur during processing
    • applicable

      protected boolean applicable(@Nonnull Attr attr, @Nonnull DOMTraversalContext context)
      Returns whether the given attribute is applicable to our traversal.
      Parameters:
      attr - Attr candidate for visiting
      context - DOMTraversalContext implementation being used to manage the traversal
      Returns:
      returns whether the given attribute is applicable to our traversal
    • doInitialize

      protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException
      Overrides:
      doInitialize in class AbstractElementVisitingValidationStage<T,Attr>
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException