Interface ObjectgraphVisitor


public interface ObjectgraphVisitor
Visitor for the object graph.

The methods will be called as specific parts in the object graph are reached. The visits follow a depth-first approach.

All methods accept a VisitController. Use it to control the traversal.

Author:
Peter Lamby
See Also:
  • Method Details

    • visitByteArray

      default void visitByteArray(byte[] value, VisitController control)
      Called when a byte[] is encountered.
      Parameters:
      value - the byte array.
      control - the control.
    • visitShortArray

      default void visitShortArray(short[] value, VisitController control)
      Called when a short[] is encountered.
      Parameters:
      value - the short array.
      control - the control.
    • visitIntArray

      default void visitIntArray(int[] value, VisitController control)
      Called when an int[] is encountered.
      Parameters:
      value - the int array.
      control - the control.
    • visitLongArray

      default void visitLongArray(long[] value, VisitController control)
      Called when a long[] is encountered.
      Parameters:
      value - the long array.
      control - the control.
    • visitFloatArray

      default void visitFloatArray(float[] value, VisitController control)
      Called when a float[] is encountered.
      Parameters:
      value - the float array.
      control - the control.
    • visitDoubleArray

      default void visitDoubleArray(double[] value, VisitController control)
      Called when a double[] is encountered.
      Parameters:
      value - the double array.
      control - the control.
    • visitBooleanArray

      default void visitBooleanArray(boolean[] value, VisitController control)
      Called when a boolean[] is encountered.
      Parameters:
      value - the boolean array.
      control - the control.
    • visitCharArray

      default void visitCharArray(char[] value, VisitController control)
      Called when a char[] is encountered.
      Parameters:
      value - the char array.
      control - the control.
    • visitNull

      default void visitNull(VisitController control)
      Called when a null value is encountered.
      Parameters:
      control - the control.
    • beforeObject

      default void beforeObject(@Nullable Object value, VisitController control, boolean alreadySeen)
      Called when any value is encountered.

      This means this method is called once before most of the specific visit methods here are called.

      It is not called before the leave.. and following methods:

      The visit will usually decend further into the objectgraph after this method. To avoid infinite traversing we will not continue if the already saw the object in the current path.

      Parameters:
      value - the value.
      control - the control.
      alreadySeen - true if we already saw this object. false otherwise.
    • visitEnum

      default void visitEnum(Enum<?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitClass

      default void visitClass(Object value, VisitController control)
      Called when visiting "normal" class.

      Called when the value is not already handled bye

      Parameters:
      value - the value.
      control - the control.
    • visitClassField

      default void visitClassField(Object value, Field field, VisitController control)
      Called when visiting a field in a class.

      Note that value is not the value of the field. It is the instance which contains field.

      This is called directly after visitClass(Object, VisitController). Only the members that are declared in the specific class will be visited.

      If there are parent classes visitSuperClass(Object, Class, VisitController) will be called for each parent and this method will be called after each step in the class hierarchy.

      The following fields (and their values) will be ignored and not visited:

      • primitives like int or char
      • static fields
      • fields that are not accessible and can't be made acessible
      Parameters:
      value - the instance to which field belongs.
      field - The field inside value.
      control - the control.
      See Also:
    • visitSuperClass

      default void visitSuperClass(Object value, Class<?> superType, VisitController control)
      Called when visiting the parent of a class.

      Called after all fields have been already visited.

      Parameters:
      value - the value.
      superType - the current type in the class hierarchy.
      control - the control.
    • leaveClass

      default void leaveClass(Object value, VisitController control)
      Called when visiting of a class has finished.

      This means visitClass(Object, VisitController) visitClassField(Object, Field, VisitController) and visitSuperClass(Object, Class, VisitController) have already handled all values.

      Parameters:
      value - the value.
      control - the control.
    • visitArray

      default void visitArray(@Nullable Object[] value, VisitController control)
      Called when an non primitive array is encountered.
      Parameters:
      value - the array.
      control - the control.
    • visitArrayMember

      default void visitArrayMember(@Nullable Object value, int idx, @Nullable Object[] array, VisitController control)
      Called for every entry in an non primitive array.
      Parameters:
      value - the value.
      idx - the index of value in array.
      array - the entire array.
      control - the control.
    • leaveArray

      default void leaveArray(@Nullable Object[] value, VisitController control)
      Called after all members in an array have been visited.
      Parameters:
      value - the array.
      control - the control.
    • visitNonListIterable

      default void visitNonListIterable(Iterable<?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitIterableMember

      default void visitIterableMember(Object value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • leaveIterable

      default void leaveIterable(Object value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitList

      default void visitList(List<?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitListMember

      default void visitListMember(Object value, int idx, List<?> list, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      idx - todo
      list - todo
      control - the control.
    • leaveList

      default void leaveList(List<?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitMap

      default void visitMap(Map<?,?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.
    • visitMapEntry

      default void visitMapEntry(Object key, Object value, Map<?,?> map, VisitController control)
      Not yet implemented.
      Parameters:
      key - todo
      value - the value.
      map - todo
      control - the control.
    • leaveMap

      default void leaveMap(Map<?,?> value, VisitController control)
      Not yet implemented.
      Parameters:
      value - the value.
      control - the control.