@Component public class AvroSchemaServiceManagerImpl extends Object implements AvroSchemaServiceManager
AvroSchemaServiceManager.
Helps to substitute the default implementation of Schema
Generation using Custom Avro schema generator
Provide a custom bean definition of AvroSchemaServiceManager and mark
it as @Primary to override this default implementation| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
AvroSchemaServiceManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.avro.io.DatumReader<Object> |
getDatumReader(Class<?> type,
org.apache.avro.Schema schema,
org.apache.avro.Schema writerSchema)
get
DatumReader. |
org.apache.avro.io.DatumWriter<Object> |
getDatumWriter(Class<?> type,
org.apache.avro.Schema schema)
get
DatumWriter. |
org.apache.avro.Schema |
getSchema(Class<?> clazz)
get
Schema. |
Object |
readData(Class<? extends Object> clazz,
byte[] payload,
org.apache.avro.Schema readerSchema,
org.apache.avro.Schema writerSchema)
read data from avro type payload
DatumReader. |
public org.apache.avro.Schema getSchema(Class<?> clazz)
Schema.getSchema in interface AvroSchemaServiceManagerclazz - Class for which schema generation
is requiredpublic org.apache.avro.io.DatumWriter<Object> getDatumWriter(Class<?> type, org.apache.avro.Schema schema)
DatumWriter.getDatumWriter in interface AvroSchemaServiceManagertype - Class of java object which needs to be serializedschema - Schema of object which needs to be serializedpublic org.apache.avro.io.DatumReader<Object> getDatumReader(Class<?> type, org.apache.avro.Schema schema, org.apache.avro.Schema writerSchema)
DatumReader.getDatumReader in interface AvroSchemaServiceManagertype - Class of java object which needs to be serializedschema - Schema default schema of object which needs to be de-serializedwriterSchema - Schema writerSchema provided at run timepublic Object readData(Class<? extends Object> clazz, byte[] payload, org.apache.avro.Schema readerSchema, org.apache.avro.Schema writerSchema) throws IOException
DatumReader.readData in interface AvroSchemaServiceManagerclazz - Class of java object which needs to be serializedpayload - byte serialized payload of object which needs to be de-serializedreaderSchema - Schema readerSchema of object which needs to be de-serializedwriterSchema - Schema writerSchema used to while serializing payloadIOException - is thrown in case of errorCopyright © 2019 Pivotal Software, Inc.. All rights reserved.