Class CloningVisitor

java.lang.Object
org.apache.avro.compiler.schema.CloningVisitor
All Implemented Interfaces:
SchemaVisitor<org.apache.avro.Schema>

public final class CloningVisitor extends Object implements SchemaVisitor<org.apache.avro.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.
  • Constructor Details

    • CloningVisitor

      public CloningVisitor(org.apache.avro.Schema root)
      copy only serialization necessary fields.
      Parameters:
      root -
    • CloningVisitor

      public CloningVisitor(CloningVisitor.PropertyCopier copyProperties, boolean copyDocs, org.apache.avro.Schema root)
  • Method Details

    • visitTerminal

      public SchemaVisitorAction visitTerminal(org.apache.avro.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<org.apache.avro.Schema>
      Parameters:
      terminal -
    • visitNonTerminal

      public SchemaVisitorAction visitNonTerminal(org.apache.avro.Schema nt)
      Description copied from interface: SchemaVisitor
      Invoked for schema with children before proceeding to visit the children.
      Specified by:
      visitNonTerminal in interface SchemaVisitor<org.apache.avro.Schema>
      Parameters:
      nt -
    • afterVisitNonTerminal

      public SchemaVisitorAction afterVisitNonTerminal(org.apache.avro.Schema nt)
      Description copied from interface: SchemaVisitor
      Invoked for schemas with children after its children have been visited.
      Specified by:
      afterVisitNonTerminal in interface SchemaVisitor<org.apache.avro.Schema>
      Parameters:
      nt -
    • get

      public org.apache.avro.Schema get()
      Description copied from interface: SchemaVisitor
      Invoked when visiting is complete.
      Specified by:
      get in interface SchemaVisitor<org.apache.avro.Schema>
      Returns:
      a value which will be returned by the visit method.
    • toString

      public String toString()
      Overrides:
      toString in class Object