org.apache.avro.compiler.schema

## Class CloningVisitor

- java.lang.Object
- - org.apache.avro.compiler.schema.CloningVisitor

- All Implemented Interfaces:
    SchemaVisitor<Schema>

      public final class CloningVisitor
      extends Object
      implements SchemaVisitor<Schema>

  this visitor will create a clone of the original Schema with docs and other nonessential fields stripped by default. what attributes are copied is customizable.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `CloningVisitor.PropertyCopier`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CloningVisitor(CloningVisitor.PropertyCopier copyProperties, boolean copyDocs, Schema root)`
    `CloningVisitor(Schema root)` copy only serialization necessary fields.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SchemaVisitorAction` | `afterVisitNonTerminal(Schema nt)` Invoked for schemas with children after its children have been visited.
    `Schema` | `get()` Invoked when visiting is complete.
    `String` | `toString()`
    `SchemaVisitorAction` | `visitNonTerminal(Schema nt)` Invoked for schema with children before proceeding to visit the children.
    `SchemaVisitorAction` | `visitTerminal(Schema terminal)` Invoked for schemas that do not have "child" schemas (like string, int ...) or for a previously encountered schema with children, which will be treated as a terminal.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CloningVisitor

          public CloningVisitor(Schema root)

      copy only serialization necessary fields.
      Parameters:
        `root` -

    - #### CloningVisitor

          public CloningVisitor(CloningVisitor.PropertyCopier copyProperties,
                                boolean copyDocs,
                                Schema root)

  - ### Method Detail

    - #### visitTerminal

          public SchemaVisitorAction visitTerminal(Schema terminal)

      Description copied from interface: `SchemaVisitor`
      Invoked for schemas that do not have "child" schemas (like string, int ...) or for a previously encountered schema with children, which will be treated as a terminal. (to avoid circular recursion)
      Specified by:
        `visitTerminal` in interface `SchemaVisitor<Schema>`

    - #### visitNonTerminal

          public SchemaVisitorAction visitNonTerminal(Schema nt)

      Description copied from interface: `SchemaVisitor`
      Invoked for schema with children before proceeding to visit the children.
      Specified by:
        `visitNonTerminal` in interface `SchemaVisitor<Schema>`

    - #### afterVisitNonTerminal

          public SchemaVisitorAction afterVisitNonTerminal(Schema nt)

      Description copied from interface: `SchemaVisitor`
      Invoked for schemas with children after its children have been visited.
      Specified by:
        `afterVisitNonTerminal` in interface `SchemaVisitor<Schema>`

    - #### get

          public Schema get()

      Description copied from interface: `SchemaVisitor`
      Invoked when visiting is complete.
      Specified by:
        `get` in interface `SchemaVisitor<Schema>`
      Returns:
        a value which will be returned by the visit method.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.