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 outcome of a FactCandidate: the (source, target) pairs that hold together under one choice of
010 * its ambiguous references. Generated from the schema definition CandidateOutcome by
011 * scripts/sqllr/gen_type_model.py; do not edit.
012 *
013 * @since 4.2.17
014 */
015public final class CandidateOutcome extends SqllrObject {
016
017    /** The members the schema defines, in schema order. */
018    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("pairs", "extensions"));
019
020    /** The members the schema requires. */
021    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("pairs"));
022
023    /** Reads a JSON object as a {@code CandidateOutcome}. */
024    public static final Reader<CandidateOutcome> READER = new Reader<CandidateOutcome>() {
025        @Override
026        public CandidateOutcome read(Object json) {
027            return fromJson(json);
028        }
029    };
030
031    private CandidateOutcome(Map<String, Object> members) {
032        super(members);
033    }
034
035    /** A {@code CandidateOutcome} with the members of a JSON object, all kept. */
036    public static CandidateOutcome fromJson(Object json) {
037        return new CandidateOutcome(members(json, "CandidateOutcome"));
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 pairs}. Null when absent; throws IllegalStateException when the member
051     * holds another JSON type.
052     */
053    public List<CandidatePair> getPairs() {
054        return typed("pairs", listOf(CandidatePair.READER));
055    }
056
057    /**
058     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
059     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
060     * when the member holds another JSON type.
061     */
062    public Map<String, Extension> getExtensions() {
063        return typed("extensions", mapOf(Extension.READER));
064    }
065
066    /** Collects the members of a new {@code CandidateOutcome}. */
067    public static final class Builder extends SqllrObject.Builder<CandidateOutcome, Builder> {
068        private Builder(Map<String, Object> from) {
069            super(from);
070        }
071
072        /** Sets the member {@code pairs}; null removes it. */
073        public Builder pairs(List<CandidatePair> value) {
074            return set("pairs", value);
075        }
076
077        /** Sets the member {@code extensions}; null removes it. */
078        public Builder extensions(Map<String, Extension> value) {
079            return set("extensions", value);
080        }
081
082        @Override
083        public CandidateOutcome build() {
084            return new CandidateOutcome(frozenMembers());
085        }
086    }
087}