Package com.google.caliper.memory
Interface ObjectVisitor<T>
-
- Type Parameters:
T- the type of the result that this visitor returns (can be defined asVoidto denote no result}.
public interface ObjectVisitor<T>A visitor that controls an object traversal. Implementations of this interface are passed toObjectExplorerexploration methods.- See Also:
ObjectExplorer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classObjectVisitor.TraversalConstants that denote how the traversal of a given object (chain) should continue.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tresult()Returns an arbitrary value (presumably constructed during the object graph traversal).ObjectVisitor.Traversalvisit(Chain chain)Visits an explored value (the whole chain from the root object leading to the value is provided), and decides whether to continue the exploration of that value.
-
-
-
Method Detail
-
visit
ObjectVisitor.Traversal visit(Chain chain)
Visits an explored value (the whole chain from the root object leading to the value is provided), and decides whether to continue the exploration of that value.In case the explored value is either primitive or
null(e.g., ifchain.isPrimitive() || chain.getValue() == null), the return value is meaningless and is ignored.- Parameters:
chain- the chain that leads to the explored value.- Returns:
ObjectVisitor.Traversal.EXPLOREto denote that the visited object should be further explored, orObjectVisitor.Traversal.SKIPto avoid exploring it.
-
result
T result()
Returns an arbitrary value (presumably constructed during the object graph traversal).
-
-