Class PathAwareCollectingVisitor<T>
- java.lang.Object
-
- org.linuxforhealth.fhir.model.visitor.DefaultVisitor
-
- org.linuxforhealth.fhir.model.visitor.PathAwareVisitor
-
- org.linuxforhealth.fhir.model.visitor.PathAwareCollectingVisitor<T>
-
- Type Parameters:
T
- The type of object to collect
- All Implemented Interfaces:
Visitor
public class PathAwareCollectingVisitor<T> extends PathAwareVisitor
Visits a Resource or Element and collects all of its descendants of a given type into a collection of those elements, indexed by their simple FHIRPath path.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,T>
result
protected java.lang.Class<T>
type
-
Fields inherited from class org.linuxforhealth.fhir.model.visitor.DefaultVisitor
visitChildren
-
-
Constructor Summary
Constructors Constructor Description PathAwareCollectingVisitor(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)
void
doVisit(java.lang.String elementName, byte[] value)
void
doVisit(java.lang.String elementName, java.lang.Boolean value)
void
doVisit(java.lang.String elementName, java.lang.Integer value)
void
doVisit(java.lang.String elementName, java.lang.String value)
void
doVisit(java.lang.String elementName, java.math.BigDecimal value)
void
doVisit(java.lang.String elementName, java.time.LocalDate value)
void
doVisit(java.lang.String elementName, java.time.LocalTime value)
void
doVisit(java.lang.String elementName, java.time.Year value)
void
doVisit(java.lang.String elementName, java.time.YearMonth value)
void
doVisit(java.lang.String elementName, java.time.ZonedDateTime value)
java.util.Map<java.lang.String,T>
getResult()
boolean
visit(java.lang.String elementName, int elementIndex, Visitable visitable)
Subclasses can override this method to provide a default action for all visit methods.-
Methods inherited from class org.linuxforhealth.fhir.model.visitor.PathAwareVisitor
doVisitEnd, doVisitEnd, doVisitStart, doVisitStart, getPath, reset, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitEnd, visitEnd, visitStart, visitStart
-
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, visitStart
-
-
-
-
Constructor Detail
-
PathAwareCollectingVisitor
public PathAwareCollectingVisitor(java.lang.Class<T> type)
-
-
Method Detail
-
collect
protected void collect(java.lang.Object object)
-
getResult
public java.util.Map<java.lang.String,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
-
doVisit
public void doVisit(java.lang.String elementName, byte[] value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.math.BigDecimal value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.lang.Boolean value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.lang.Integer value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.time.LocalDate value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.time.LocalTime value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.lang.String value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.time.Year value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.time.YearMonth value)
- Overrides:
doVisit
in classPathAwareVisitor
-
doVisit
public void doVisit(java.lang.String elementName, java.time.ZonedDateTime value)
- Overrides:
doVisit
in classPathAwareVisitor
-
-