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.

@FunctionalInterface public interface ModelVisitor
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
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    shouldVisit(@NotNull String path, @NotNull Object element, @Nullable Object container, @Nullable String nameOfFieldInContainer)
    Checks whether the given element should be visited.
    void
    visit(@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 element
      element - the element to visit
      container - 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 element
      element - the element to visit
      container - 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