Package org.nuxeo.runtime.avro
Class AvroServiceImpl
java.lang.Object
org.nuxeo.runtime.avro.AvroServiceImpl
- All Implemented Interfaces:
AvroService
- Since:
- 10.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Class<?>,Class<AvroSchemaFactory<?>>> protected Map<Class<?>,AvroMapper<?, ?>> protected final List<AvroReplacementDescriptor>protected final AvroSchemaStore -
Constructor Summary
ConstructorsConstructorDescriptionAvroServiceImpl(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories) -
Method Summary
Modifier and TypeMethodDescriptionprotected AvroSchemaFactoryContext<D> org.apache.avro.SchemacreateSchema(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 storevoidsetMappers(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:AvroServiceGets the Schema store- Specified by:
getSchemaStorein interfaceAvroService
-
createSchema
public <D> org.apache.avro.Schema createSchema(D input) Description copied from interface:AvroServiceCreates the Avro schema from an object.
An AvroSchemaFactory handling the object class has to be implemented and registered to the AvroComponent..- Specified by:
createSchemain interfaceAvroService- Parameters:
input- any object- Returns:
- the Avro schema
-
decodeName
Description copied from interface:AvroServiceDecodes a valid Avro name to its actual value.- Specified by:
decodeNamein interfaceAvroService- Parameters:
input- the name to decode- Returns:
- the decoded name
-
encodeName
Description copied from interface:AvroServiceEncodes 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:
encodeNamein interfaceAvroService- Parameters:
input- the name to encode- Returns:
- the encoded name
-
fromAvro
Description copied from interface:AvroServiceMap 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:
fromAvroin 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:AvroServiceMap an object to an Avro data.
An AvroMapper handling the given class has to be implemented and registered.- Specified by:
toAvroin interfaceAvroService- Parameters:
schema- the Avro schemainput- the object to map to an Avro data- Returns:
- the Avro data
-
createContext
-
getMapper
-