Package org.nuxeo.runtime.avro
Class AvroServiceImpl
java.lang.Object
org.nuxeo.runtime.avro.AvroServiceImpl
- All Implemented Interfaces:
AvroService
- Since:
- 10.2
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Class<?>,
Class<AvroSchemaFactory<?>>> protected Map<Class<?>,
AvroMapper<?, ?>> protected final List<AvroReplacementDescriptor>
protected final AvroSchemaStore
-
Constructor Summary
ConstructorDescriptionAvroServiceImpl
(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories) -
Method Summary
Modifier and TypeMethodDescriptionprotected AvroSchemaFactoryContext
<D> org.apache.avro.Schema
createSchema
(D input) Creates the Avro schema from an object.
An AvroSchemaFactory handling the object class has to be implemented and registered to the AvroComponent..decodeName
(String input) Decodes a valid Avro name to its actual value.encodeName
(String input) Encodes a name for it to be eligible to Avro limitations (alphanumeric and _).
By default Nuxeo can encode - and :
Other replacements can be registered to the AvroComponent.<D,
M> D Map an Avro data to an instance of the given class.
An AvroMapper handling the given class has to be implemented and registered to the AvroComponent..protected <D,
M> AvroMapper<D, M> Gets the Schema storevoid
setMappers
(Map<Class<?>, AvroMapper<?, ?>> mappers) <D,
M> M toAvro
(org.apache.avro.Schema schema, D input) Map an object to an Avro data.
An AvroMapper handling the given class has to be implemented and registered.
-
Field Details
-
factories
-
replacements
-
schemaStore
-
mappers
-
-
Constructor Details
-
AvroServiceImpl
public AvroServiceImpl(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories)
-
-
Method Details
-
getSchemaStore
Description copied from interface:AvroService
Gets the Schema store- Specified by:
getSchemaStore
in interfaceAvroService
-
createSchema
public <D> org.apache.avro.Schema createSchema(D input) Description copied from interface:AvroService
Creates the Avro schema from an object.
An AvroSchemaFactory handling the object class has to be implemented and registered to the AvroComponent..- Specified by:
createSchema
in interfaceAvroService
- Parameters:
input
- any object- Returns:
- the Avro schema
-
decodeName
Description copied from interface:AvroService
Decodes a valid Avro name to its actual value.- Specified by:
decodeName
in interfaceAvroService
- Parameters:
input
- the name to decode- Returns:
- the decoded name
-
encodeName
Description copied from interface:AvroService
Encodes a name for it to be eligible to Avro limitations (alphanumeric and _).
By default Nuxeo can encode - and :
Other replacements can be registered to the AvroComponent.- Specified by:
encodeName
in interfaceAvroService
- Parameters:
input
- the name to encode- Returns:
- the encoded name
-
fromAvro
Description copied from interface:AvroService
Map an Avro data to an instance of the given class.
An AvroMapper handling the given class has to be implemented and registered to the AvroComponent..- Specified by:
fromAvro
in interfaceAvroService
- Parameters:
schema
- the Avro schemaclazz
- the class to map the Avro object toinput
- the Avro data- Returns:
- an instance of the given class
-
setMappers
-
toAvro
public <D,M> M toAvro(org.apache.avro.Schema schema, D input) Description copied from interface:AvroService
Map an object to an Avro data.
An AvroMapper handling the given class has to be implemented and registered.- Specified by:
toAvro
in interfaceAvroService
- Parameters:
schema
- the Avro schemainput
- the object to map to an Avro data- Returns:
- the Avro data
-
createContext
-
getMapper
-