T - is the type of the deserialized object that is passed to toValue and returned by toObject. The specific
type depends on the particular binding that is used. It may be an
Avro-generated specific class that implements SpecificRecord, a
GenericRecord, a JsonRecord, or a RawRecord.public interface AvroBinding<T> extends ValueBinding<T>
AvroBinding interface has the same methods as ValueBinding, but adds semantics and exceptions that are specific to the
Avro data format.
All AvroBinding subtypes -- SpecificAvroBinding, GenericAvroBinding, JsonAvroBinding and RawAvroBinding --
operate on the built-in Avro data format. The serialized data used and
produced by the binding -- the byte array of the Value -- is
serialized Avro data, packaged in an internal format that includes a
reference to the Avro schema. The toValue method of each
Avro binding returns this serialized format, and the toObject method is passed this serialized format.
See AvroCatalog for a comparison of the different types of Avro
bindings and the trade-offs in using them.
T toObject(Value value) throws SchemaNotAllowedException, IllegalArgumentException
KVStore method, the user
calls toObject with the Value obtained from the read
operation.toObject in interface ValueBinding<T>value - the Value obtained from a KVStore read
operation method.. The byte array of the Value is
serialized Avro data, packaged in an internal format that includes a
reference to the Avro schemaSchemaNotAllowedException - if the schema associated with the
value parameter is not allowed with this binding.IllegalArgumentException - if the value format is not Value.Format.AVRO, the schema identifier embedded in the value
parameter is invalid, or the serialized data cannot be parsed.Value toValue(T object) throws SchemaNotAllowedException, UndefinedSchemaException, IllegalArgumentException
toValue passing
an object she wishes to store. The resulting Value is then
passed to the write operation method in KVStore.toValue in interface ValueBinding<T>object - the object the user wishes to store, or at least
serialize.Value is
serialized Avro data, packaged in an internal format that includes a
reference to the Avro schemaSchemaNotAllowedException - if the schema associated with the
object parameter is not allowed with this binding.UndefinedSchemaException - if the schema associated with the
object parameter has not been defined using the NoSQL Database
administration interface. Note that when the allowed schemas for a
binding are specified (and validate) at the time the binding is created,
this exception is extremely unlikely and is only possible if a schema is
mistakenly disabled after the binding is created.IllegalArgumentException - if the object parameter is
invalid according to its schema, and cannot be serialized.Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.