Interface SchemaAdapter

Record Components:
expectedSchema - The type Schema that the value needs to be adapted to.
datum - The value that needs to be adapted to the specified schema

public interface SchemaAdapter
Try to adapt the to the . The following steps are followed: 1. If the schema type doesn't allow for adaptation, return the same value that was passed in input. 2. If the schema type allows for adaptation, then 2a. If the value doesn't specify a value for any field, the default value is used 2b. If a field is mandatory, but no default values are specified, then an Exception is thrown
  • Method Summary

    Modifier and Type
    Method
    Description
    adapt(org.apache.avro.Schema expectedSchema, Object datum)
     
    static Object
    adaptToSchema(org.apache.avro.Schema expectedSchema, Object datum)
    Checks if it is possible for some value to be modified to adapt to the provided schema type.
    getSchemaAdapter(org.apache.avro.Schema.Type expectedSchemaType)
    Checks if it is possible for some value to be modified to adapt to the provided schema type.
  • Method Details

    • adapt

      Object adapt(org.apache.avro.Schema expectedSchema, Object datum)
    • getSchemaAdapter

      static SchemaAdapter getSchemaAdapter(org.apache.avro.Schema.Type expectedSchemaType)
      Checks if it is possible for some value to be modified to adapt to the provided schema type.
      Parameters:
      expectedSchemaType - The type Schema.Type that the value needs to be adapted to.
      Returns:
      true if a value can be modified to adapt to the provided schema type; false otherwise.
    • adaptToSchema

      static Object adaptToSchema(org.apache.avro.Schema expectedSchema, Object datum)
      Checks if it is possible for some value to be modified to adapt to the provided schema type.
      Parameters:
      expectedSchemaType - The type Schema.Type that the value needs to be adapted to.
      Returns:
      true if a value can be modified to adapt to the provided schema type; false otherwise.