See: Description
Class | Description |
---|---|
CustomEncoding<T> |
Expert: a custom encoder and decoder that writes an object directly to avro.
|
DateAsLongEncoding |
This encoder/decoder writes a java.util.Date object as a long to avro and
reads a Date object from long.
|
MapEntry<K,V> |
Class to make Avro immune from the naming variations of key/value fields
among several
Map.Entry implementations. |
ReflectData |
Utilities to use existing Java classes and interfaces via reflection.
|
ReflectData.AllowNull |
ReflectData implementation that permits null field values. |
ReflectDatumReader<T> |
DatumReader for existing classes via
Java reflection. |
ReflectDatumWriter<T> |
DatumWriter for existing classes via
Java reflection. |
ReflectionUtil |
A few utility methods for using @link{java.misc.Unsafe}, mostly for private
use.
|
Annotation Type | Description |
---|---|
AvroAlias |
Adds the given name and space as an alias to the schema.
|
AvroDefault |
Specifies a default value for a field as a JSON string.
|
AvroDoc |
Sets the avrodoc for this java field.
|
AvroEncode |
Expert: Fields with this annotation are encoded using the given custom
encoder.
|
AvroIgnore |
Marks a field as transient.
|
AvroMeta |
Adds the given key:Value pair as metadata into the schema, at the
corresponding node.
|
AvroMeta.AvroMetas | |
AvroName |
Sets the avroname for this java field.
|
AvroSchema |
Declares that a Java type should have a specified Avro schema, overriding the
normally inferred schema.
|
Nullable |
Declares that null is a valid value for a Java type.
|
Stringable |
Declares that a class or field should be represented by an Avro string.
|
Union |
Declares that a Java type should be represented by an Avro union schema.
|
Java types are mapped to Avro schemas as follows:
Nullable
or a Union
containing Void
.Union
annotation, the "java-element"
property is set to the union's class, e.g.:
{"type": "array", "java-element": "org.acme.Foo"}
{"type": "array", "java-class": "java.util.ArrayList"}
String
is mapped to an Avro string schema.{"type": "int", "java-class": "java.lang.Short"}
BigDecimal
, BigInteger
,
URI
, URL
, File
are mapped to an Avro string schema as
Stringable
types and
serialized via their toString
method and de-serialized via their String
constructor.
This is done via the "java-class", "java-key-class" or
"java-element-class" depending on whether it is a field, or map key
or a list/map element, e.g.:
{"type": "string", "java-class": "java.math.BigDecimal"}
generic
API.The Union
annotation can be used
to support reflection of schemas for interfaces, abstract base classes
and other uses of polymorphism.
The Stringable
annotation
will cause a type to be serialized via its toString
method.
Fields annotated with AvroIgnore
will not be written or read to.
The AvroName
annotation renames
the field in the schema to the given name. The reflect datum reader will look
for a schema field with the given name, when trying to read into such an
annotated java field.
The AvroMeta
annotation adds an
arbitrary key:value pair in the schema at the node of the java field.
The AvroSchema
annotation forces
the use of an custom schema.
The AvroEncode
annotation forces
the use of an custom encoder. This annotation overrides
Stringable
and
Nullable
.
Copyright © 2009–2020 The Apache Software Foundation. All rights reserved.