Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util
Class ObjectWalker

    java.lang.Object
      ix.util.ObjectWalker

All Implemented Interfaces:
  ObjectVisitor

Direct Known Subclasses:
  DomainAsPlan.Pass1, PlanAsDomain.PlanWalker

    public class ObjectWalker

extends java.lang.Object
implements ObjectVisitor

Walks objects.

Field Summary
`protected ClassSyntax` | `syntax`

Constructor Summary
`ObjectWalker()` Creates a walker that uses the default ClassSyntax.
`ObjectWalker(ClassSyntax syntax)` Creates a walker that uses the specified ClassSyntax as a source for ClassDescrs.

Method Summary
`static java.util.Collection` | `collectIf(java.lang.Object source, java.util.Collection result, Predicate1 p)` Uses the specified result collection to collect subobjects that satisfy a predicate.
`static java.util.Collection` | `collectIf(java.lang.Object source, Predicate1 p)` Uses a HashSet to collect subobjects that satisfy a predicate.
`static java.lang.Object` | `findIf(java.lang.Object source, Predicate1 p)` Returns the first subobject that satisfies a predicate
`static void` | `main(java.lang.String[] argv)` Test loop
`void` | `visitElement(java.lang.Object elt)` Called on subobjects of the object being walked.
`void` | `visitList(java.util.List obj, ClassDescr cd)` Walks a List, calling `visitElement(Object)` on each element of the list.
`void` | `visitMap(java.util.Map obj, ClassDescr cd)` Walks a Map, calling `visitElement(Object)` on each key and value.
`void` | `visitPrimitive(java.lang.Object obj, ClassDescr cd)` Visits a "primitive" object.
`void` | `visitSet(java.util.Set obj, ClassDescr cd)` Walks a Set, calling `visitElement(Object)` on each member of the set.
`void` | `visitStruct(java.lang.Object obj, ClassDescr cd)` Walks a structure, calling `visitElement(Object)` on each field value.
`void` | `visitXML(LiteralDocument xml, ClassDescr cd)` Walks embedded XML.
`void` | `walk(java.lang.Object obj)` Visits the subobjects of an object.

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

Field Detail

### syntax

    protected ClassSyntax syntax

Constructor Detail

### ObjectWalker

    public ObjectWalker()

  Creates a walker that uses the default ClassSyntax.

  See Also:
    `XML.config()`, `XMLConfig.defaultClassSyntax()`

### ObjectWalker

    public ObjectWalker(ClassSyntax syntax)

  Creates a walker that uses the specified ClassSyntax as a source for ClassDescrs.

Method Detail

### findIf

    public static java.lang.Object findIf(java.lang.Object source,
                                          Predicate1 p)

  Returns the first subobject that satisfies a predicate

### collectIf

    public static java.util.Collection collectIf(java.lang.Object source,
                                                 Predicate1 p)

  Uses a HashSet to collect subobjects that satisfy a predicate. Calls `collectIf(Object, Collection, Predicate1)`.

### collectIf

    public static java.util.Collection collectIf(java.lang.Object source,
                                                 java.util.Collection result,
                                                 Predicate1 p)

  Uses the specified result collection to collect subobjects that satisfy a predicate. An object that satisfies the predicate is added to the result before its subobjects are visited.

### walk

    public void walk(java.lang.Object obj)

  Visits the subobjects of an object. Whether this is deep (recursive) or shallow (top-level only) depends on the `visitElement(Object)` method.

### visitElement

    public void visitElement(java.lang.Object elt)

  Called on subobjects of the object being walked. The method in the ObjectWalker class calls `walk(Object)` on the element and thus implements a recursive walk.

### visitPrimitive

    public void visitPrimitive(java.lang.Object obj,
                               ClassDescr cd)

  Visits a "primitive" object. It's status as a primitive was determined by the ClassDescr. In the ObjectWalker class, visitPrimitive does nothing.

  Specified by:
    `visitPrimitive` in interface `ObjectVisitor`

### visitStruct

    public void visitStruct(java.lang.Object obj,
                            ClassDescr cd)

  Walks a structure, calling `visitElement(Object)` on each field value.

  Specified by:
    `visitStruct` in interface `ObjectVisitor`

### visitXML

    public void visitXML(LiteralDocument xml,
                         ClassDescr cd)

  Walks embedded XML. The method in the ObjectWalker class does nothing.

  Specified by:
    `visitXML` in interface `ObjectVisitor`

### visitList

    public void visitList(java.util.List obj,
                          ClassDescr cd)

  Walks a List, calling `visitElement(Object)` on each element of the list.

  Specified by:
    `visitList` in interface `ObjectVisitor`

### visitSet

    public void visitSet(java.util.Set obj,
                         ClassDescr cd)

  Walks a Set, calling `visitElement(Object)` on each member of the set.

  Specified by:
    `visitSet` in interface `ObjectVisitor`

### visitMap

    public void visitMap(java.util.Map obj,
                         ClassDescr cd)

  Walks a Map, calling `visitElement(Object)` on each key and value.

  Specified by:
    `visitMap` in interface `ObjectVisitor`

### main

    public static void main(java.lang.String[] argv)

  Test loop

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD