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 ObjectCopier

    java.lang.Object
      ix.util.ObjectCopier

All Implemented Interfaces:
  ObjectMapper

Direct Known Subclasses:
  DeepCopier

    public class ObjectCopier

extends java.lang.Object
implements ObjectMapper

Copies Objects.

Field Summary
`protected ClassSyntax` | `syntax`

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

Method Summary
`java.lang.Object` | `copy(java.lang.Object obj)` Returns a copy of the object.
`LList` | `copyLList(LList obj)` Copies an LList that has a spine made of instances of any mixture of Cons subclasses, calling `mapElement(Object)` on each list element as it goes.
`static void` | `main(java.lang.String[] argv)` Test loop
`java.lang.Object` | `mapElement(java.lang.Object elt)` Called on subobjects of the object being copied to determine what object takes the subobject's place in the copy.
`java.lang.Object` | `mapList(java.util.List obj, ClassDescr cd)` Copies a List, calling `mapElement(Object)` on each element of the list.
`java.lang.Object` | `mapMap(java.util.Map obj, ClassDescr cd)` Copies a Map, calling `mapElement(Object)` on each key and value.
`java.lang.Object` | `mapPrimitive(java.lang.Object obj, ClassDescr cd)` Copies a "primitive" object.
`java.lang.Object` | `mapSet(java.util.Set obj, ClassDescr cd)` Copies a Set, calling `mapElement(Object)` on each member of the set.
`java.lang.Object` | `mapStruct(java.lang.Object obj, ClassDescr cd)` Copies a structure, calling `mapElement(Object)` on each field value.
`java.lang.Object` | `mapXML(LiteralDocument xml, ClassDescr cd)` Copies embedded XML.

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

### ObjectCopier

    public ObjectCopier()

  Creates a copier that uses the default ClassSyntax.

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

### ObjectCopier

    public ObjectCopier(ClassSyntax syntax)

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

Method Detail

### copy

    public java.lang.Object copy(java.lang.Object obj)

  Returns a copy of the object. Whether this is a deep or shallow (top-level only) copy depends on the `mapElement(Object)` method.

### mapElement

    public java.lang.Object mapElement(java.lang.Object elt)

  Called on subobjects of the object being copied to determine what object takes the subobject's place in the copy. The method in the ObjectCopier class is the identity function. In a subclass that made a deep (recursive) copy, it would call `copy(Object)` on the element.

### mapPrimitive

    public java.lang.Object mapPrimitive(java.lang.Object obj,
                                         ClassDescr cd)

  Copies a "primitive" object. It's status as a primitive was determined by the ClassDescr. In the ObjectCopier class, mapPrimitive is the identity function.

  Specified by:
    `mapPrimitive` in interface `ObjectMapper`

### mapStruct

    public java.lang.Object mapStruct(java.lang.Object obj,
                                      ClassDescr cd)

  Copies a structure, calling `mapElement(Object)` on each field value.

  Specified by:
    `mapStruct` in interface `ObjectMapper`

### mapXML

    public java.lang.Object mapXML(LiteralDocument xml,
                                   ClassDescr cd)

  Copies embedded XML. The method in the ObjectCopier class is the identity function.

  Specified by:
    `mapXML` in interface `ObjectMapper`

### mapList

    public java.lang.Object mapList(java.util.List obj,
                                    ClassDescr cd)

  Copies a List, calling `mapElement(Object)` on each element of the list. If the list is an LList, this method calls `copyLList(LList)` to do the work.

  Specified by:
    `mapList` in interface `ObjectMapper`

### copyLList

    public LList copyLList(LList obj)

  Copies an LList that has a spine made of instances of any mixture of Cons subclasses, calling `mapElement(Object)` on each list element as it goes.

  See Also:
    `LList`, `Cons`

### mapSet

    public java.lang.Object mapSet(java.util.Set obj,
                                   ClassDescr cd)

  Copies a Set, calling `mapElement(Object)` on each member of the set.

  Specified by:
    `mapSet` in interface `ObjectMapper`

### mapMap

    public java.lang.Object mapMap(java.util.Map obj,
                                   ClassDescr cd)

  Copies a Map, calling `mapElement(Object)` on each key and value.

  Specified by:
    `mapMap` in interface `ObjectMapper`

### 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