Package com.ibm.fhir.model.visitor
Class PathAwareVisitor
- java.lang.Object
-
- com.ibm.fhir.model.visitor.DefaultVisitor
-
- com.ibm.fhir.model.visitor.PathAwareVisitor
-
- All Implemented Interfaces:
Visitor
- Direct Known Subclasses:
GeneratingVisitor
,ResourceFingerprintVisitor
@NotThreadSafe public class PathAwareVisitor extends DefaultVisitor
PathAwareVisitor extends the DefaultVisitor with agetPath()
method that can be used to get the FHIRPath path of a Resource or Element during a visit.
-
-
Field Summary
-
Fields inherited from class com.ibm.fhir.model.visitor.DefaultVisitor
visitChildren
-
-
Constructor Summary
Constructors Constructor Description PathAwareVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doVisit(String elementName, String value)
protected void
doVisitEnd(String elementName, int elementIndex, Resource resource)
protected void
doVisitEnd(String elementName, int elementIndex, Element element)
protected void
doVisitStart(String elementName, int elementIndex, Resource resource)
protected void
doVisitStart(String elementName, int elementIndex, Element element)
String
getPath()
Get the FHIRPath path of the Resource or Element currently being visited.void
reset()
Reset the state of the PathAwareVisitor.void
visit(String elementName, String value)
void
visitEnd(String elementName, int elementIndex, Resource resource)
void
visitEnd(String elementName, int elementIndex, Element element)
void
visitStart(String elementName, int elementIndex, Resource resource)
void
visitStart(String elementName, int elementIndex, Element element)
-
Methods inherited from class com.ibm.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, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitEnd, visitStart
-
-
-
-
Method Detail
-
getPath
public final String getPath()
Get the FHIRPath path of the Resource or Element currently being visited. This method is primarily for subclasses but can also be used externally to retrieve a path to the Resource or Element that was being visited when an Exception occurs.- Returns:
- The path of the Resource or Element currently being visited, the path that was being visited when an exception was thrown, or null if there is no Resource or Element being visited.
-
reset
public final void reset()
Reset the state of the PathAwareVisitor. Invoke this method when visiting has failed and you want to clear the path in order to re-use the visitor.
-
visitEnd
public final void visitEnd(String elementName, int elementIndex, Element element)
- Specified by:
visitEnd
in interfaceVisitor
- Overrides:
visitEnd
in classDefaultVisitor
-
visitEnd
public final void visitEnd(String elementName, int elementIndex, Resource resource)
- Specified by:
visitEnd
in interfaceVisitor
- Overrides:
visitEnd
in classDefaultVisitor
-
visitStart
public final void visitStart(String elementName, int elementIndex, Element element)
- Specified by:
visitStart
in interfaceVisitor
- Overrides:
visitStart
in classDefaultVisitor
-
visitStart
public final void visitStart(String elementName, int elementIndex, Resource resource)
- Specified by:
visitStart
in interfaceVisitor
- Overrides:
visitStart
in classDefaultVisitor
-
visit
public final void visit(String elementName, String value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
-