# Package org.apache.avro

package org.apache.avro
Avro kernel classes.

A `Schema` provides an abstract definition of a data type.

The in-memory representation of data is determined by `DatumReader` and `DatumWriter` implementations. Generic implementations are provided in the `org.apache.avro.generic` package. A

invalid @link

    {@link <a href="../../../org/apache/avro/compiler/specific/SpecificCompiler.html" title="class in org.apache.avro.compiler.specific">

`compiler`} can generate specific java classes and interfaces for schemas and protocols. Schemas may be automatically generated for existing Java classes by reflection using the `org.apache.avro.reflect` package.

Data of a given schema is always serialized identically, regardless of its in-memory representation, by traversing the schema and writing leaf values from the data structure with a `Encoder`. Deserializing similarly proceeds by traversing the schema, reading leaf values with a `Decoder` and storing them in an in-memory data structure.

Related Packages
Package
Description
org.apache.avro.data
Interfaces and base classes shared by generic, specific and reflect.
org.apache.avro.file
A container file for Avro data.
org.apache.avro.generic
A generic representation for Avro data.
org.apache.avro.io
Utilities for Encoding and Decoding Avro data.
org.apache.avro.message
org.apache.avro.path
Interfaces and base classes for AvroPath.
org.apache.avro.reflect
Use Java reflection to generate schemas and protocols for existing classes.
org.apache.avro.specific
Generate specific Java classes for schemas and protocols.
org.apache.avro.util
Common utility classes.
Class
Description
AvroMissingFieldException
Avro exception in case of missing fields.
AvroRemoteException
Base class for exceptions thrown to client by server.
AvroRuntimeException
Base Avro exception.
AvroTypeException
Thrown when an illegal type is used.
CanonicalSchemaFormatterFactory
Schema formatter factory that supports the "Parsing Canonical Form".
Conversion<T>
Conversion between generic and logical type instances.
Conversions
Conversions.BigDecimalConversion
Conversions.DecimalConversion
Conversions.DurationConversion
Conversions.UUIDConversion
FormattedSchemaParser
Schema parser for a specific schema format.
InvalidAvroMagicException
InvalidNumberEncodingException
JsonProperties
Base class for objects that have JSON-valued properties.
JsonProperties.Null
JsonSchemaFormatter
JsonSchemaFormatterFactory
JsonSchemaParser
Schema parser for JSON formatted schemata.
LogicalType
Logical types provides an opt-in way to extend Avro's types.
LogicalTypes
LogicalTypes.BigDecimal
LogicalTypes.Date
Date represents a date without a time
LogicalTypes.Decimal
Decimal represents arbitrary-precision fixed-scale decimal numbers
LogicalTypes.Duration
Duration represents a duration, consisting on months, days and milliseconds
LogicalTypes.LocalTimestampMicros
LogicalTypes.LocalTimestampMillis
LogicalTypes.LocalTimestampNanos
LogicalTypes.LogicalTypeFactory
Factory interface and SPI for logical types.
LogicalTypes.TimeMicros
TimeMicros represents a time in microseconds without a date
LogicalTypes.TimeMillis
TimeMillis represents a time in milliseconds without a date
LogicalTypes.TimestampMicros
TimestampMicros represents a date and time in microseconds
LogicalTypes.TimestampMillis
TimestampMillis represents a date and time in milliseconds
LogicalTypes.TimestampNanos
TimestampNanos represents a date and time in nanoseconds
LogicalTypes.Uuid
Uuid represents a uuid without a time
NameValidator
NameValidator.Result
ParseContext
Class to define a name context, useful to reference schemata with.
Protocol
A set of messages forming an application protocol.
Resolver
Encapsulate schema-resolution logic in an easy-to-consume representation.
Resolver.Action
An abstract class for an action to be taken to resolve a writer's schema (found in public instance variable `writer`) against a reader's schema (in `reader`).
Resolver.Action.Type
Helps us traverse faster.
Resolver.Container
Used for array and map schemas: the public instance variable `elementAction` contains the resolving action needed for the element type of an array or value top of a map.
Resolver.DoNothing
In this case, there's nothing to be done for resolution: the two schemas are effectively the same.
Resolver.EnumAdjust
Contains information needed to resolve enumerations.
Resolver.ErrorAction
In this case there is an error.
Resolver.ErrorAction.ErrorType
Resolver.Promote
In this case, the writer's type needs to be promoted to the reader's.
Resolver.ReaderUnion
In this case, the reader is a union and the writer is not.
Resolver.RecordAdjust
Instructions for resolving two record schemas.
Resolver.Skip
This only appears inside `Resolver.RecordAdjust.fieldActions`, i.e., the actions for adjusting the fields of a record.
Resolver.WriterUnion
In this case, the writer was a union.
Schema
An abstract data type.
Schema.Field
A field within a record.
Schema.Field.Order
How values of this field should be ordered when sorting records.
Schema.Parser
A parser for JSON-format schemas.
Schema.SeenPair
Useful as key of `Map`s when traversing two schemas at the same time and need to watch for recursion.
Schema.Type
The type of schema.
SchemaBuilder
A fluent interface for building `Schema` instances.
SchemaBuilder.ArrayBuilder<R>
Builds an Avro Array type with optional properties.
SchemaBuilder.ArrayDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.BaseFieldTypeBuilder<R>
A special Builder for Record fields.
SchemaBuilder.BaseTypeBuilder<R>
A common API for building types within a context.
SchemaBuilder.BooleanBuilder<R>
Builds an Avro boolean type with optional properties.
SchemaBuilder.BooleanDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.BytesBuilder<R>
Builds an Avro bytes type with optional properties.
SchemaBuilder.BytesDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.DoubleBuilder<R>
Builds an Avro double type with optional properties.
SchemaBuilder.DoubleDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.EnumBuilder<R>
Builds an Avro Enum type with optional properties, namespace, doc, and aliases.
SchemaBuilder.EnumDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.FieldAssembler<R>
SchemaBuilder.FieldBuilder<R>
Builds a Field in the context of a `SchemaBuilder.FieldAssembler`.
SchemaBuilder.FieldDefault<R,S extends SchemaBuilder.FieldDefault<R,S>>
Abstract base class for field defaults.
SchemaBuilder.FieldTypeBuilder<R>
FieldTypeBuilder adds `SchemaBuilder.FieldTypeBuilder.unionOf()`, `SchemaBuilder.FieldTypeBuilder.nullable()`, and `SchemaBuilder.FieldTypeBuilder.optional()` to BaseFieldTypeBuilder.
SchemaBuilder.FixedBuilder<R>
Builds an Avro Fixed type with optional properties, namespace, doc, and aliases.
SchemaBuilder.FixedDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.FloatBuilder<R>
Builds an Avro float type with optional properties.
SchemaBuilder.FloatDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.GenericDefault<R>
SchemaBuilder.IntBuilder<R>
Builds an Avro int type with optional properties.
SchemaBuilder.IntDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.LongBuilder<R>
Builds an Avro long type with optional properties.
SchemaBuilder.LongDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.MapBuilder<R>
Builds an Avro Map type with optional properties.
SchemaBuilder.MapDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.NamedBuilder<S extends SchemaBuilder.NamedBuilder<S>>
An abstract type that provides builder methods for configuring the name, doc, and aliases of all Avro types that have names (fields, Fixed, Record, and Enum).
SchemaBuilder.NamespacedBuilder<R,S extends SchemaBuilder.NamespacedBuilder<R,S>>
An abstract type that provides builder methods for configuring the namespace for all Avro types that have namespaces (Fixed, Record, and Enum).
SchemaBuilder.NullBuilder<R>
Builds an Avro null type with optional properties.
SchemaBuilder.NullDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.PropBuilder<S extends SchemaBuilder.PropBuilder<S>>
An abstract builder for all Avro types.
SchemaBuilder.RecordBuilder<R>
SchemaBuilder.RecordDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.StringBldr<R>
Builds an Avro string type with optional properties.
SchemaBuilder.StringDefault<R>
Choose whether to use a default value for the field or not.
SchemaBuilder.TypeBuilder<R>
A Builder for creating any Avro schema type.
SchemaBuilder.UnionAccumulator<R>
Accumulates all of the types in a union.
SchemaBuilder.UnionFieldTypeBuilder<R>
Builder for a union field.
SchemaBuilderException
Thrown for errors building schemas.
SchemaCompatibility
Evaluate the compatibility between a reader schema and a writer schema.
SchemaCompatibility.Incompatibility
SchemaCompatibility.SchemaCompatibilityResult
Immutable class representing details about a particular schema pair compatibility check.
SchemaCompatibility.SchemaCompatibilityType
Identifies the type of a schema compatibility result.
SchemaCompatibility.SchemaIncompatibilityType
SchemaCompatibility.SchemaPairCompatibility
Provides information about the compatibility of a single reader and writer schema pair.
SchemaFormatter
Interface and factory to format schemas to text.
SchemaFormatterFactory
Service Provider Interface (SPI) for `SchemaFormatter`.
SchemaNormalization
Collection of static methods for generating the canonical form of schemas (see `SchemaNormalization.toParsingForm(org.apache.avro.Schema)`) -- and fingerprints of canonical forms (`SchemaNormalization.fingerprint(java.lang.String, byte[])`).
SchemaParseException
Thrown for errors parsing schemas and protocols.
SchemaParser
Avro schema parser for text-based formats like JSON, IDL, etc.
SchemaParser.ParseResult
SchemaValidationException
Thrown when `SchemaValidator` fails to validate a schema.
SchemaValidationStrategy
An interface for validating the compatibility of a single schema against another.
SchemaValidator
A SchemaValidator has one method, which validates that a `Schema` is compatible with the other schemas provided.
SchemaValidatorBuilder
A Builder for creating SchemaValidators.
SystemLimitException
Thrown to prevent making large allocations when reading potentially pathological input data from an untrusted source.
UnknownAvroCodecException
UnresolvedUnionException
Thrown when the expected contents of a union cannot be resolved.
ValidateAll
A `SchemaValidator` for validating the provided schema against all schemas in the Iterable in `ValidateAll.validate(Schema, Iterable)`.
ValidateLatest
A `SchemaValidator` for validating the provided schema against the first `Schema` in the iterable in `ValidateLatest.validate(Schema, Iterable)`.