Class CollectingVisitor<T>

  • Type Parameters:
    T - The type of object to collect
    All Implemented Interfaces:
    Visitor

    public class CollectingVisitor<T>
    extends DefaultVisitor
    Visits a Resource or Element and collects all of its descendants of a given type into a single list
    • Field Detail

      • result

        protected final java.util.List<T> result
      • type

        protected final java.lang.Class<T> type
    • Constructor Detail

      • CollectingVisitor

        public CollectingVisitor​(java.lang.Class<T> type)
    • Method Detail

      • collect

        protected void collect​(java.lang.Object object)
      • getResult

        public java.util.List<T> getResult()
      • visit

        public boolean visit​(java.lang.String elementName,
                             int elementIndex,
                             Visitable visitable)
        Description copied from class: DefaultVisitor
        Subclasses can override this method to provide a default action for all visit methods.
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
        Returns:
        whether to visit the children of this resource; returns the value of the visitChildren boolean by default
      • visit

        public void visit​(java.lang.String elementName,
                          byte[] value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.math.BigDecimal value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.lang.Boolean value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.lang.Integer value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.time.LocalDate value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.time.LocalTime value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.lang.String value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.time.Year value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.time.YearMonth value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
      • visit

        public void visit​(java.lang.String elementName,
                          java.time.ZonedDateTime value)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor