objectexplorer
Interface ObjectVisitor<T>

Type Parameters:
T - the type of the result that this visitor returns (can be defined as Void to denote no result}.

public interface ObjectVisitor<T>

A visitor that controls an object traversal. Implementations of this interface are passed to ObjectExplorer exploration methods.

See Also:
ObjectExplorer

Nested Class Summary
static class ObjectVisitor.Traversal
          Constants that denote how the traversal of a given object (chain) should continue.
 
Method Summary
 T result()
          Returns an arbitrary value (presumably constructed during the object graph traversal).
 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.
 

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., if chain.isPrimitive() || chain.getValue() == null), the return value is meaningless and is ignored.

Parameters:
chain - the chain that leads to the explored value.
Returns:
Traversal.EXPLORE to denote that the visited object should be further explored, or ObjectVisitor.Traversal.SKIP to avoid exploring it.

result

T result()
Returns an arbitrary value (presumably constructed during the object graph traversal).