Interface AvroService

All Known Implementing Classes:
AvroServiceImpl

public interface AvroService
This service allows to create a AvroSchemaFactoryContext.
Since:
10.2
  • Method Summary

    Modifier and Type
    Method
    Description
    <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..
    Decodes a valid Avro name to its actual value.
    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
    fromAvro(org.apache.avro.Schema schema, Class<D> clazz, M object)
    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..
    Gets the Schema store
    <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.
  • Method Details

    • getSchemaStore

      AvroSchemaStore getSchemaStore()
      Gets the Schema store
      Since:
      10.3
    • createSchema

      <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..
      Parameters:
      input - any object
      Returns:
      the Avro schema
    • decodeName

      String decodeName(String input)
      Decodes a valid Avro name to its actual value.
      Parameters:
      input - the name to decode
      Returns:
      the decoded name
    • encodeName

      String 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.
      Parameters:
      input - the name to encode
      Returns:
      the encoded name
    • fromAvro

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

      <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.
      Parameters:
      schema - the Avro schema
      input - the object to map to an Avro data
      Returns:
      the Avro data