Interface ModelVisitor
- All Known Implementing Classes:
AutoCreationPhase,AutoLinkPhase,BuilderVisitingPhaseAction,CleanupPhase,DefaultPhase,EarlyValidationPhase,ModelVisitingPhaseAction,OwnerPhase,PostTreePhase,ValidationPhase,VisitingPhaseAction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Visitor for a model tree. Note that the default behavior is to only handle DSL objects, this can be changed by overriding
shouldVisit(String, Object, Object, String).-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault ModelVisitor.ActionshouldVisit(@NotNull String path, @NotNull Object element, @Nullable Object container, @Nullable String nameOfFieldInContainer) Checks whether the given element should be visited.voidvisit(@NotNull String path, @NotNull Object element, @Nullable Object container, @Nullable String nameOfFieldInContainer) Visit the given element.
-
Method Details
-
visit
void visit(@NotNull @NotNull String path, @NotNull @NotNull Object element, @Nullable @Nullable Object container, @Nullable @Nullable String nameOfFieldInContainer) Visit the given element.- Parameters:
path- a string (GSON-like) representation of the path from the root to this elementelement- the element to visitcontainer- The object containing this element. If the element is a member of a collection or map, the object containing the collection or map.nameOfFieldInContainer- The name of the field in the container pointing to this object (or its collection/map
-
shouldVisit
default ModelVisitor.Action shouldVisit(@NotNull @NotNull String path, @NotNull @NotNull Object element, @Nullable @Nullable Object container, @Nullable @Nullable String nameOfFieldInContainer) Checks whether the given element should be visited. The defautlt implementation is to only handle DSL objects.- Parameters:
path- a string (GSON-like) representation of the path from the root to this elementelement- the element to visitcontainer- The object containing this element. If the element is a member of a collection or map, the object containing the collection or map.nameOfFieldInContainer- The name of the field in the container pointing to this object (or its collection/map- Returns:
- whether to skip, visit or skip subtree
-