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

io.apicurio.registry.resolver.SchemaLookupResult Maven / Gradle / Ivy

There is a newer version: 3.0.4
Show newest version
package io.apicurio.registry.resolver;

import io.apicurio.registry.resolver.strategy.ArtifactCoordinates;
import io.apicurio.registry.resolver.strategy.ArtifactReference;

public class SchemaLookupResult {

    private ParsedSchema parsedSchema;

    private long globalId;
    private long contentId;
    private String contentHash;
    private String groupId;
    private String artifactId;
    private String version;

    private SchemaLookupResult() {
        // empty initialize manually
    }

    /**
     * @return the parsedSchema
     */
    public ParsedSchema getParsedSchema() {
        return parsedSchema;
    }

    /**
     * @return the globalId
     */
    public long getGlobalId() {
        return globalId;
    }

    /**
     * @return the contentId
     */
    public long getContentId() {
        return contentId;
    }

    /**
     * @return the contentHash
     */
    public String getContentHash() {
        return contentHash;
    }

    /**
     * @return the groupId
     */
    public String getGroupId() {
        return groupId;
    }

    /**
     * @return the artifactId
     */
    public String getArtifactId() {
        return artifactId;
    }

    /**
     * @return the version
     */
    public String getVersion() {
        return version;
    }

    public ArtifactReference toArtifactReference() {
        return ArtifactReference.builder().globalId(this.getGlobalId()).contentId(this.getContentId())
                .contentHash(this.getContentHash()).groupId(this.getGroupId())
                .artifactId(this.getArtifactId()).version(this.getVersion()).build();
    }

    public ArtifactCoordinates toArtifactCoordinates() {
        return ArtifactCoordinates.builder().groupId(this.getGroupId()).artifactId(this.getArtifactId())
                .version(this.getVersion()).build();
    }

    public static  SchemaLookupResultBuilder builder() {
        return new SchemaLookupResultBuilder();
    }

    public static class SchemaLookupResultBuilder {

        private SchemaLookupResult result;

        SchemaLookupResultBuilder() {
            this.result = new SchemaLookupResult<>();
        }

        public SchemaLookupResultBuilder parsedSchema(ParsedSchema parsedSchema) {
            this.result.parsedSchema = parsedSchema;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder globalId(long globalId) {
            this.result.globalId = globalId;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder contentId(long contentId) {
            this.result.contentId = contentId;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder contentHash(String contentHash) {
            this.result.contentHash = contentHash;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder groupId(String groupId) {
            this.result.groupId = groupId;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder artifactId(String artifactId) {
            this.result.artifactId = artifactId;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResultBuilder version(String version) {
            this.result.version = version;
            return SchemaLookupResultBuilder.this;
        }

        public SchemaLookupResult build() {
            return this.result;
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy