public class AvroSchema extends Object implements com.fasterxml.jackson.core.FormatSchema
| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<AvroStructureReader> |
_reader
Lazily instantiated value reader for this schema.
|
protected org.apache.avro.Schema |
_writerSchema
Schema that was used for writing the data to decode; for simple instance
used for reading as well (reader schema).
|
static String |
TYPE_ID
Format type id used by Jackson components to refer to Avro Format.
|
| Constructor and Description |
|---|
AvroSchema(org.apache.avro.Schema asch) |
| Modifier and Type | Method and Description |
|---|---|
protected AvroStructureReader |
_constructReader() |
boolean |
equals(Object o) |
org.apache.avro.Schema |
getAvroSchema()
Accessor for "writer schema" contained in this instance.
|
AvroStructureReader |
getReader() |
String |
getSchemaType() |
int |
hashCode() |
String |
toString() |
AvroSchema |
withReaderSchema(AvroSchema readerSchema)
Method that will consider this schema instance (used as so-called "Writer Schema"),
and specified "Reader Schema" instance, and will either construct a new schema
with appropriate translations, to use for reading (if reader and writer schemas are
not same); or, if schemas are the same, return `this`.
|
AvroSchema |
withUnsafeReaderSchema(AvroSchema readerSchema)
Similar to
withReaderSchema(com.fasterxml.jackson.dataformat.avro.AvroSchema) but will NOT verify compatibility of schemas:
this means that certain problems (such as missing default value for a newly added
field) that would be caught at construction may be surfaced later when using
schema. |
public static final String TYPE_ID
protected final org.apache.avro.Schema _writerSchema
protected final AtomicReference<AvroStructureReader> _reader
public AvroSchema withReaderSchema(AvroSchema readerSchema) throws com.fasterxml.jackson.core.JsonProcessingException
Note that neither `this` instance nor `readerSchema` is ever modified: if an altered version is needed, a new schema object will be constructed.
NOTE: this is a relatively expensive operation due to validation (although significant
part of cost is deferred until the first call to getReader()) so it is recommended
that these instances are reused whenever possible.
readerSchema - "Reader Schema" to use (in Avro terms): schema that specified how
reader wants to see the data; specifies part of translation needed along with this
schema (which would be "Writer Schema" in Avro terms).com.fasterxml.jackson.core.JsonProcessingException - If given reader schema is incompatible with (writer-)
schema this instance was constructed with,public AvroSchema withUnsafeReaderSchema(AvroSchema readerSchema) throws com.fasterxml.jackson.core.JsonProcessingException
withReaderSchema(com.fasterxml.jackson.dataformat.avro.AvroSchema) but will NOT verify compatibility of schemas:
this means that certain problems (such as missing default value for a newly added
field) that would be caught at construction may be surfaced later when using
schema. This is, however, sometimes necessary to work around potential BUT NOT ACTUAL
problems.com.fasterxml.jackson.core.JsonProcessingExceptionpublic String getSchemaType()
getSchemaType in interface com.fasterxml.jackson.core.FormatSchemapublic org.apache.avro.Schema getAvroSchema()
public AvroStructureReader getReader()
protected AvroStructureReader _constructReader()
Copyright © 2017 FasterXML. All rights reserved.