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 * Details of a DATASET_DEPENDENCY Fact (Section 7.2). Module dataset-dependency; members beyond
010 * these are defined later. Generated from the schema definition DatasetDependency by
011 * scripts/sqllr/gen_type_model.py; do not edit.
012 *
013 * @since 4.2.17
014 */
015public final class DatasetDependency extends SqllrObject {
016
017    /** The members the schema defines, in schema order. */
018    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("reasons", "derivationAlgorithmId", "supportingFactRefs"));
019
020    /** The members the schema requires. */
021    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("reasons", "derivationAlgorithmId"));
022
023    /** Reads a JSON object as a {@code DatasetDependency}. */
024    public static final Reader<DatasetDependency> READER = new Reader<DatasetDependency>() {
025        @Override
026        public DatasetDependency read(Object json) {
027            return fromJson(json);
028        }
029    };
030
031    private DatasetDependency(Map<String, Object> members) {
032        super(members);
033    }
034
035    /** A {@code DatasetDependency} with the members of a JSON object, all kept. */
036    public static DatasetDependency fromJson(Object json) {
037        return new DatasetDependency(members(json, "DatasetDependency"));
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 reasons}. Null when absent; throws IllegalStateException when the member
051     * holds another JSON type.
052     */
053    public List<String> getReasons() {
054        return typed("reasons", listOf(STRING));
055    }
056
057    /**
058     * The member {@code derivationAlgorithmId}. Null when absent; throws IllegalStateException when
059     * the member holds another JSON type.
060     */
061    public String getDerivationAlgorithmId() {
062        return string("derivationAlgorithmId");
063    }
064
065    /**
066     * The member {@code supportingFactRefs}. A set of local references. Null when absent; throws
067     * IllegalStateException when the member holds another JSON type.
068     */
069    public List<Long> getSupportingFactRefs() {
070        return typed("supportingFactRefs", listOf(INTEGER));
071    }
072
073    /** Collects the members of a new {@code DatasetDependency}. */
074    public static final class Builder extends SqllrObject.Builder<DatasetDependency, Builder> {
075        private Builder(Map<String, Object> from) {
076            super(from);
077        }
078
079        /** Sets the member {@code reasons}; null removes it. */
080        public Builder reasons(List<String> value) {
081            return set("reasons", value);
082        }
083
084        /** Sets the member {@code derivationAlgorithmId}; null removes it. */
085        public Builder derivationAlgorithmId(String value) {
086            return set("derivationAlgorithmId", value);
087        }
088
089        /** Sets the member {@code supportingFactRefs}; null removes it. */
090        public Builder supportingFactRefs(List<Long> value) {
091            return set("supportingFactRefs", value);
092        }
093
094        @Override
095        public DatasetDependency build() {
096            return new DatasetDependency(frozenMembers());
097        }
098    }
099}