001package gudusoft.gsqlparser.lineage.v2.model;
002
003import java.util.Arrays;
004import java.util.Collections;
005import java.util.List;
006import java.util.Map;
007
008/**
009 * One metadata artifact supplied to an analysis (algorithms/identity-v1.md, Section 5.11).
010 * Generated from the schema definition MetadataArtifact by scripts/sqllr/gen_type_model.py; do not
011 * edit.
012 *
013 * @since 4.2.17
014 */
015public final class MetadataArtifact extends SqllrObject {
016
017    /** The members the schema defines, in schema order. */
018    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("format", "sha256"));
019
020    /** The members the schema requires. */
021    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("format", "sha256"));
022
023    /** Reads a JSON object as a {@code MetadataArtifact}. */
024    public static final Reader<MetadataArtifact> READER = new Reader<MetadataArtifact>() {
025        @Override
026        public MetadataArtifact read(Object json) {
027            return fromJson(json);
028        }
029    };
030
031    private MetadataArtifact(Map<String, Object> members) {
032        super(members);
033    }
034
035    /** A {@code MetadataArtifact} with the members of a JSON object, all kept. */
036    public static MetadataArtifact fromJson(Object json) {
037        return new MetadataArtifact(members(json, "MetadataArtifact"));
038    }
039
040    public static Builder builder() {
041        return new Builder(null);
042    }
043
044    /** A builder holding every member of this object. */
045    public Builder toBuilder() {
046        return new Builder(toJson());
047    }
048
049    /**
050     * The member {@code format}. The format id of the artifact, declared by the caller or the
051     * producer, such as a media type or a versioned catalog export format. The same bytes under
052     * another format id are other metadata. Null when absent; throws IllegalStateException when the
053     * member holds another JSON type.
054     */
055    public String getFormat() {
056        return string("format");
057    }
058
059    /**
060     * The member {@code sha256}. SHA-256 of the artifact bytes exactly as supplied. A SHA-256
061     * digest: 64 lowercase hexadecimal characters. Null when absent; throws IllegalStateException
062     * when the member holds another JSON type.
063     */
064    public String getSha256() {
065        return string("sha256");
066    }
067
068    /** Collects the members of a new {@code MetadataArtifact}. */
069    public static final class Builder extends SqllrObject.Builder<MetadataArtifact, Builder> {
070        private Builder(Map<String, Object> from) {
071            super(from);
072        }
073
074        /** Sets the member {@code format}; null removes it. */
075        public Builder format(String value) {
076            return set("format", value);
077        }
078
079        /** Sets the member {@code sha256}; null removes it. */
080        public Builder sha256(String value) {
081            return set("sha256", value);
082        }
083
084        @Override
085        public MetadataArtifact build() {
086            return new MetadataArtifact(frozenMembers());
087        }
088    }
089}