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

io.apicurio.registry.serde.strategy.SimpleTopicIdStrategy Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package io.apicurio.registry.serde.strategy;

import io.apicurio.registry.resolver.ParsedSchema;
import io.apicurio.registry.resolver.data.Record;
import io.apicurio.registry.resolver.strategy.ArtifactReference;
import io.apicurio.registry.resolver.strategy.ArtifactReferenceResolverStrategy;
import io.apicurio.registry.serde.data.SerdeRecord;

public class SimpleTopicIdStrategy implements ArtifactReferenceResolverStrategy {

    /**
     * @see io.apicurio.registry.resolver.strategy.ArtifactReferenceResolverStrategy#artifactReference(io.apicurio.registry.resolver.data.Record,
     *      io.apicurio.registry.resolver.ParsedSchema)
     */
    @Override
    public ArtifactReference artifactReference(Record data, ParsedSchema parsedSchema) {
        SerdeRecord kdata = (SerdeRecord) data;
        return ArtifactReference.builder().groupId(null).artifactId(kdata.metadata().getTopic()).build();
    }

    /**
     * @see io.apicurio.registry.serde.strategy.ArtifactResolverStrategy#loadSchema()
     */
    @Override
    public boolean loadSchema() {
        return false;
    }

}