Class CollectingVisitor<T>
- java.lang.Object
-
- org.linuxforhealth.fhir.model.visitor.DefaultVisitor
-
- org.linuxforhealth.fhir.model.util.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 Summary
Fields Modifier and Type Field Description protected java.util.List<T>
result
protected java.lang.Class<T>
type
-
Fields inherited from class org.linuxforhealth.fhir.model.visitor.DefaultVisitor
visitChildren
-
-
Constructor Summary
Constructors Constructor Description CollectingVisitor(java.lang.Class<T> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
collect(java.lang.Object object)
java.util.List<T>
getResult()
void
visit(java.lang.String elementName, byte[] value)
boolean
visit(java.lang.String elementName, int elementIndex, Visitable visitable)
Subclasses can override this method to provide a default action for all visit methods.void
visit(java.lang.String elementName, java.lang.Boolean value)
void
visit(java.lang.String elementName, java.lang.Integer value)
void
visit(java.lang.String elementName, java.lang.String value)
void
visit(java.lang.String elementName, java.math.BigDecimal value)
void
visit(java.lang.String elementName, java.time.LocalDate value)
void
visit(java.lang.String elementName, java.time.LocalTime value)
void
visit(java.lang.String elementName, java.time.Year value)
void
visit(java.lang.String elementName, java.time.YearMonth value)
void
visit(java.lang.String elementName, java.time.ZonedDateTime value)
-
Methods inherited from class org.linuxforhealth.fhir.model.visitor.DefaultVisitor
postVisit, postVisit, preVisit, preVisit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitEnd, visitEnd, visitEnd, visitStart, visitStart, visitStart
-
-
-
-
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 interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
- 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 interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.math.BigDecimal value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.lang.Boolean value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.lang.Integer value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.time.LocalDate value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.time.LocalTime value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.lang.String value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.time.Year value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.time.YearMonth value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(java.lang.String elementName, java.time.ZonedDateTime value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
-