Class SchemaProjector

java.lang.Object
org.apache.kafka.connect.data.SchemaProjector

public class SchemaProjector extends Object

SchemaProjector is a utility to project a value between compatible schemas and throw exceptions when non compatible schemas are provided.

  • Constructor Details

    • SchemaProjector

      public SchemaProjector()
  • Method Details

    • project

      public static Object project(Schema source, Object record, Schema target) throws SchemaProjectorException
      This method projects a value between compatible schemas and throws exceptions when non-compatible schemas are provided
      Parameters:
      source - the schema used to construct the record
      record - the value to project from source schema to target schema
      target - the schema to project the record to
      Returns:
      the projected value with target schema
      Throws:
      SchemaProjectorException - if the target schema is not optional and does not have a default value