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 Summary
Modifier and TypeMethodDescriptiondefault voidbeforeObject(@Nullable Object value, VisitController control, boolean alreadySeen) Called when any value is encountered.default voidleaveArray(@Nullable Object[] value, VisitController control) Called after all members in an array have beenvisited.default voidleaveArrayMember(@Nullable Object value, int idx, @Nullable Object[] array, VisitController control) Called when leaving an entry in an non primitive array.default voidleaveClass(Object value, VisitController control) Called when visiting of a class has finished.default voidleaveClassField(Object value, Field field, VisitController control) Called when leaving a class field.default voidvisitArray(@Nullable Object[] value, VisitController control) Called when an non primitive array is encountered.default voidvisitArrayMember(@Nullable Object value, int idx, @Nullable Object[] array, VisitController control) Called for every entry in an non primitive array.default voidvisitBooleanArray(boolean[] value, VisitController control) Called when aboolean[]is encountered.default voidvisitByteArray(byte[] value, VisitController control) Called when abyte[]is encountered.default voidvisitCharArray(char[] value, VisitController control) Called when achar[]is encountered.default voidvisitClass(Object value, VisitController control) Called when visiting "normal" class.default voidvisitClassField(Object value, Field field, VisitController control) Called when visiting a field in a class.default voidvisitDoubleArray(double[] value, VisitController control) Called when adouble[]is encountered.default voidvisitFloatArray(float[] value, VisitController control) Called when afloat[]is encountered.default voidvisitIntArray(int[] value, VisitController control) Called when anint[]is encountered.default voidvisitLongArray(long[] value, VisitController control) Called when along[]is encountered.default voidvisitNull(VisitController control) Called when anullvalue is encountered.default voidvisitShortArray(short[] value, VisitController control) Called when ashort[]is encountered.default voidvisitSuperClass(Object value, Class<?> superType, VisitController control) Called when visiting the parent of a class.
-
Method Details
-
visitByteArray
Called when abyte[]is encountered.- Parameters:
value- the byte array.control- the control.
-
visitShortArray
Called when ashort[]is encountered.- Parameters:
value- the short array.control- the control.
-
visitIntArray
Called when anint[]is encountered.- Parameters:
value- the int array.control- the control.
-
visitLongArray
Called when along[]is encountered.- Parameters:
value- the long array.control- the control.
-
visitFloatArray
Called when afloat[]is encountered.- Parameters:
value- the float array.control- the control.
-
visitDoubleArray
Called when adouble[]is encountered.- Parameters:
value- the double array.control- the control.
-
visitBooleanArray
Called when aboolean[]is encountered.- Parameters:
value- the boolean array.control- the control.
-
visitCharArray
Called when achar[]is encountered.- Parameters:
value- the char array.control- the control.
-
visitNull
Called when anullvalue is encountered.- Parameters:
control- the control.
-
beforeObject
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-trueif we already saw this object.falseotherwise.
-
visitClass
Called when visiting "normal" class.Called when the
valueis not already handled bye- The primitive array methods
visitArray(Object[], VisitController)visitNull(VisitController)
- Parameters:
value- the value.control- the control.
-
visitClassField
Called when visiting a field in a class.Note that
valueis not the value of the field. It is the instance which containsfield.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
intorchar - static fields
- fields that are not accessible and can't be made acessible
- Parameters:
value- the instance to whichfieldbelongs.field- The field insidevalue.control- the control.- See Also:
- primitives like
-
leaveClassField
Called when leaving a class field.Note that
valueis not the value of the field. It is the instance which containsfield.- Parameters:
value- the instance to whichfieldbelongs.field- The field insidevalue.control- the control.- See Also:
-
visitSuperClass
Called when visiting the parent of a class.Called after all
fieldshave been already visited.- Parameters:
value- the value.superType- the current type in the class hierarchy.control- the control.
-
leaveClass
Called when visiting of a class has finished.This means
visitClass(Object, VisitController)visitClassField(Object, Field, VisitController)andvisitSuperClass(Object, Class, VisitController)have already handled all values.- Parameters:
value- the value.control- the control.
-
visitArray
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 ofvalueinarray.array- the entire array.control- the control.
-
leaveArrayMember
default void leaveArrayMember(@Nullable Object value, int idx, @Nullable Object[] array, VisitController control) Called when leaving an entry in an non primitive array.- Parameters:
value- the value.idx- the index ofvalueinarray.array- the entire array.control- the control.
-
leaveArray
Called after all members in an array have beenvisited.- Parameters:
value- the array.control- the control.
-