All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.atleon.schemaregistry.confluent.AvroRegistrySerializerConfig Maven / Gradle / Ivy

There is a newer version: 0.28.3
Show newest version
package io.atleon.schemaregistry.confluent;

import org.apache.kafka.common.config.ConfigDef;

import java.util.Map;

public final class AvroRegistrySerializerConfig extends RegistrySerializerConfig {

    public static final String AVRO_REFLECTION_ALLOW_NULL_CONFIG = "avro.reflection.allow.null";
    public static final boolean AVRO_REFLECTION_ALLOW_NULL_DEFAULT = false;
    public static final String AVRO_REFLECTION_ALLOW_NULL_DOC =
        "If true, allows null field values used in ReflectAvroSerializer";

    public static final String AVRO_USE_LOGICAL_TYPE_CONVERTERS_CONFIG = "avro.use.logical.type.converters";
    public static final boolean AVRO_USE_LOGICAL_TYPE_CONVERTERS_DEFAULT = false;
    public static final String AVRO_USE_LOGICAL_TYPE_CONVERTERS_DOC =
        "If true, use logical type converter in generic record";

    public static final String AVRO_REMOVE_JAVA_PROPS_CONFIG = "avro.remove.java.properties";
    public static final boolean AVRO_REMOVE_JAVA_PROPS_DEFAULT = false;
    public static final String AVRO_REMOVE_JAVA_PROPS_DOC =
        "Whether to remove Java-specific properties generated by Avro";

    public static final String SCHEMA_CACHING_ENABLED_CONFIG = "writer.schema.caching";
    public static final boolean SCHEMA_CACHING_ENABLED_DEFAULT = false;
    public static final String SCHEMA_CACHING_ENABLED_DOC =
        "If true, activates caching of writer schemas. Only helpful when schemas are generated" +
            " dynamically at serialization time, and the schemas are stable by serialization " +
            " type (i.e. serialization type is concrete and not generic nor parameterized).";

    public static final String SCHEMA_GENERATION_ENABLED_CONFIG = "writer.schema.generation";
    public static final boolean SCHEMA_GENERATION_ENABLED_DEFAULT = false;
    public static final String SCHEMA_GENERATION_ENABLED_DOC =
        "If true, activates deep generation of writer schemas. Only helpful when schemas are" +
            " generated dynamically at serialization time, and serialization type is generic" +
            " or parameterized.";

    public AvroRegistrySerializerConfig(Map props) {
        super(avroRegistrySerializerConfigDef(), props);
    }

    public static ConfigDef avroRegistrySerializerConfigDef() {
        return registrySerializerConfigDef()
            .define(AVRO_REFLECTION_ALLOW_NULL_CONFIG, ConfigDef.Type.BOOLEAN, AVRO_REFLECTION_ALLOW_NULL_DEFAULT, ConfigDef.Importance.LOW, AVRO_REFLECTION_ALLOW_NULL_DOC)
            .define(AVRO_USE_LOGICAL_TYPE_CONVERTERS_CONFIG, ConfigDef.Type.BOOLEAN, AVRO_USE_LOGICAL_TYPE_CONVERTERS_DEFAULT, ConfigDef.Importance.MEDIUM, AVRO_USE_LOGICAL_TYPE_CONVERTERS_DOC)
            .define(AVRO_REMOVE_JAVA_PROPS_CONFIG, ConfigDef.Type.BOOLEAN, AVRO_REMOVE_JAVA_PROPS_DEFAULT, ConfigDef.Importance.MEDIUM, AVRO_REMOVE_JAVA_PROPS_DOC)
            .define(SCHEMA_CACHING_ENABLED_CONFIG, ConfigDef.Type.BOOLEAN, SCHEMA_CACHING_ENABLED_DEFAULT, ConfigDef.Importance.MEDIUM, SCHEMA_CACHING_ENABLED_DOC)
            .define(SCHEMA_GENERATION_ENABLED_CONFIG, ConfigDef.Type.BOOLEAN, SCHEMA_GENERATION_ENABLED_DEFAULT, ConfigDef.Importance.MEDIUM, SCHEMA_GENERATION_ENABLED_DOC);
    }

    public boolean reflectionAllowNull() {
        return getBoolean(AVRO_REFLECTION_ALLOW_NULL_CONFIG);
    }

    public boolean useLogicalTypeConverters() {
        return getBoolean(AVRO_USE_LOGICAL_TYPE_CONVERTERS_CONFIG);
    }

    public boolean removeJavaProperties() {
        return getBoolean(AVRO_REMOVE_JAVA_PROPS_CONFIG);
    }

    public boolean schemaCachingEnabled() {
        return getBoolean(SCHEMA_CACHING_ENABLED_CONFIG);
    }

    public boolean schemaGenerationEnabled() {
        return getBoolean(SCHEMA_GENERATION_ENABLED_CONFIG);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy