Class AvroServiceImpl

java.lang.Object
org.nuxeo.runtime.avro.AvroServiceImpl
All Implemented Interfaces:
AvroService

public class AvroServiceImpl extends Object implements AvroService
Since:
10.2
  • Field Details

  • Constructor Details

  • Method Details

    • getSchemaStore

      public AvroSchemaStore getSchemaStore()
      Description copied from interface: AvroService
      Gets the Schema store
      Specified by:
      getSchemaStore in interface AvroService
    • 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 interface AvroService
      Parameters:
      input - any object
      Returns:
      the Avro schema
    • decodeName

      public String decodeName(String input)
      Description copied from interface: AvroService
      Decodes a valid Avro name to its actual value.
      Specified by:
      decodeName in interface AvroService
      Parameters:
      input - the name to decode
      Returns:
      the decoded name
    • encodeName

      public String encodeName(String input)
      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 interface AvroService
      Parameters:
      input - the name to encode
      Returns:
      the encoded name
    • fromAvro

      public <D, M> D fromAvro(org.apache.avro.Schema schema, Class<D> clazz, M input)
      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 interface AvroService
      Parameters:
      schema - the Avro schema
      clazz - the class to map the Avro object to
      input - the Avro data
      Returns:
      an instance of the given class
    • setMappers

      public void setMappers(Map<Class<?>,AvroMapper<?,?>> mappers)
    • 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 interface AvroService
      Parameters:
      schema - the Avro schema
      input - the object to map to an Avro data
      Returns:
      the Avro data
    • createContext

      protected AvroSchemaFactoryContext createContext()
    • getMapper

      protected <D, M> AvroMapper<D,M> getMapper(Class<D> clazz)