Overview | Package | Class | Tree | Deprecated | Index | Help
| JTS Topology Suite version 1.13
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.vividsolutions.jts.util.objectgraph
Class ObjectGraphTraverser

    java.lang.Object
      com.vividsolutions.jts.util.objectgraph.ObjectGraphTraverser

    public final class ObjectGraphTraverser

extends java.lang.Object

Traverses an object graph, visiting each object, array, and primitive once only. (This effectively turns the object graph into a tree). The object tree is traversed in pre-order, meaning that each object or array is traversed (including the base object and each field) followed by any referenced objects and arrays.

The Visitor pattern is used to abstract out traversal behaviour. The methods of an `ObjectVisitor` object are called for all the objects and fields in the object graph with object and array values.

Reflection is used to access the fields of objects. Static (class) members are not visited.

An explicit stack is used to allow traversing very deep objects (such as large linked lists).

Constructor Summary
`ObjectGraphTraverser()` Creates a new traverser.

Method Summary
`void` | `traverse(java.lang.Object obj, ObjectVisitor visitor)` Traverses an object using the given visitor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ObjectGraphTraverser

    public ObjectGraphTraverser()

  Creates a new traverser.

Method Detail

### traverse

    public void traverse(java.lang.Object obj,
                         ObjectVisitor visitor)

  Traverses an object using the given visitor. The visitor is called with the argument object, as well as all object fields. Sub-objects and arrays are traversed recursively. In arrays of objects, elements are also traversed. In arrays of primitives individual elements are not traversed, but can be obtained via reflection in the `ObjectVisitor#visitArray(Field, Object)` method

  Parameters:
    `obj` - the object to traverse
    `visitor` - the object visitor

Overview | Package | Class | Tree | Deprecated | Index | Help
| JTS Topology Suite version 1.13
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD