com.fasterxml.jackson.dataformat.avro.schema

## Class RecordVisitor

- java.lang.Object
- - com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base
  - - com.fasterxml.jackson.dataformat.avro.schema.RecordVisitor

- All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWithSerializerProvider, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor, SchemaBuilder

      public class RecordVisitor
      extends com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base
      implements SchemaBuilder

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor

      `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.avro.Schema` | `_avroSchema`
    `protected List<org.apache.avro.Schema.Field>` | `_fields`
    `protected boolean` | `_overridden` Tracks if the schema for this record has been overridden (by an annotation or other means), and calls to the `property` and `optionalProperty` methods should be ignored.
    `protected DefinedSchemas` | `_schemas`
    `protected com.fasterxml.jackson.databind.JavaType` | `_type`

    - ### Fields inherited from class com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base

      `_provider`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecordVisitor(com.fasterxml.jackson.databind.SerializerProvider p, com.fasterxml.jackson.databind.JavaType type, DefinedSchemas schemas)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.avro.Schema` | `builtAvroSchema()`
    `void` | `optionalProperty(com.fasterxml.jackson.databind.BeanProperty writer)`
    `void` | `optionalProperty(String name, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable handler, com.fasterxml.jackson.databind.JavaType type)`
    `protected org.codehaus.jackson.JsonNode` | `parseJson(String defaultValue)` Parses a JSON-encoded string for use as the default value of a field
    `void` | `property(com.fasterxml.jackson.databind.BeanProperty writer)`
    `void` | `property(String name, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable handler, com.fasterxml.jackson.databind.JavaType type)`
    `protected org.apache.avro.Schema` | `reorderUnionToMatchDefaultType(org.apache.avro.Schema schema, org.codehaus.jackson.JsonNode defaultValue)` A union schema with a default value must always have the schema branch corresponding to the default value first, or Avro will print a warning complaining that the default value is not compatible.
    `protected org.apache.avro.Schema.Field` | `schemaFieldForWriter(com.fasterxml.jackson.databind.BeanProperty prop, boolean optional)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base

      `getProvider, setProvider`

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

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

- - ### Field Detail

    - #### _type

          protected final com.fasterxml.jackson.databind.JavaType _type

    - #### _schemas

          protected final DefinedSchemas _schemas

    - #### _overridden

          protected final boolean _overridden

      Tracks if the schema for this record has been overridden (by an annotation or other means), and calls to the `property` and `optionalProperty` methods should be ignored.

    - #### _avroSchema

          protected org.apache.avro.Schema _avroSchema

    - #### _fields

          protected List<org.apache.avro.Schema.Field> _fields

  - ### Constructor Detail

    - #### RecordVisitor

          public RecordVisitor(com.fasterxml.jackson.databind.SerializerProvider p,
                               com.fasterxml.jackson.databind.JavaType type,
                               DefinedSchemas schemas)

  - ### Method Detail

    - #### builtAvroSchema

          public org.apache.avro.Schema builtAvroSchema()

      Specified by:
        `builtAvroSchema` in interface `SchemaBuilder`

    - #### property

          public void property(com.fasterxml.jackson.databind.BeanProperty writer)
                        throws com.fasterxml.jackson.databind.JsonMappingException

      Specified by:
        `property` in interface `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor`
      Overrides:
        `property` in class `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base`
      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException`

    - #### property

          public void property(String name,
                               com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable handler,
                               com.fasterxml.jackson.databind.JavaType type)
                        throws com.fasterxml.jackson.databind.JsonMappingException

      Specified by:
        `property` in interface `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor`
      Overrides:
        `property` in class `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base`
      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException`

    - #### optionalProperty

          public void optionalProperty(com.fasterxml.jackson.databind.BeanProperty writer)
                                throws com.fasterxml.jackson.databind.JsonMappingException

      Specified by:
        `optionalProperty` in interface `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor`
      Overrides:
        `optionalProperty` in class `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base`
      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException`

    - #### optionalProperty

          public void optionalProperty(String name,
                                       com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable handler,
                                       com.fasterxml.jackson.databind.JavaType type)
                                throws com.fasterxml.jackson.databind.JsonMappingException

      Specified by:
        `optionalProperty` in interface `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor`
      Overrides:
        `optionalProperty` in class `com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base`
      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException`

    - #### schemaFieldForWriter

          protected org.apache.avro.Schema.Field schemaFieldForWriter(com.fasterxml.jackson.databind.BeanProperty prop,
                                                                      boolean optional)
                                                               throws com.fasterxml.jackson.databind.JsonMappingException

      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException`

    - #### parseJson

          protected org.codehaus.jackson.JsonNode parseJson(String defaultValue)
                                                     throws com.fasterxml.jackson.databind.JsonMappingException

      Parses a JSON-encoded string for use as the default value of a field
      Parameters:
        `defaultValue` - Default value as a JSON-encoded string
      Returns:
        Jackson V1 `JsonNode` for use as the default value in a `Schema.Field`
      Throws:
        `com.fasterxml.jackson.databind.JsonMappingException` - if `defaultValue` is not valid JSON

    - #### reorderUnionToMatchDefaultType

          protected org.apache.avro.Schema reorderUnionToMatchDefaultType(org.apache.avro.Schema schema,
                                                                          org.codehaus.jackson.JsonNode defaultValue)

      A union schema with a default value must always have the schema branch corresponding to the default value first, or Avro will print a warning complaining that the default value is not compatible. If `schema` is a `UNION` schema and `defaultValue` is non-`null`, this finds the appropriate branch in the union and reorders the union so that it is first.
      Parameters:
        `schema` - Schema to reorder; If `null` or not a `UNION`, then it is returned unmodified.
        `defaultValue` - Default value to match with the union
      Returns:
        A schema modified so the first branch matches the type of `defaultValue`; otherwise, `schema` is returned unmodified.

Copyright © 2019 FasterXML. All rights reserved.