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 pair of a CandidateDecision: an alternative of the deciding reference (a member of its
010 * candidate set) and the candidate this reference denotes under it (a member of this set).
011 * Generated from the schema definition CandidateAlignment by scripts/sqllr/gen_type_model.py; do
012 * not edit.
013 *
014 * @since 4.2.17
015 */
016public final class CandidateAlignment extends SqllrObject {
017
018    /** The members the schema defines, in schema order. */
019    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("alternativeRef", "candidateRef"));
020
021    /** The members the schema requires. */
022    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("alternativeRef", "candidateRef"));
023
024    /** Reads a JSON object as a {@code CandidateAlignment}. */
025    public static final Reader<CandidateAlignment> READER = new Reader<CandidateAlignment>() {
026        @Override
027        public CandidateAlignment read(Object json) {
028            return fromJson(json);
029        }
030    };
031
032    private CandidateAlignment(Map<String, Object> members) {
033        super(members);
034    }
035
036    /** A {@code CandidateAlignment} with the members of a JSON object, all kept. */
037    public static CandidateAlignment fromJson(Object json) {
038        return new CandidateAlignment(members(json, "CandidateAlignment"));
039    }
040
041    public static Builder builder() {
042        return new Builder(null);
043    }
044
045    /** A builder holding every member of this object. */
046    public Builder toBuilder() {
047        return new Builder(toJson());
048    }
049
050    /**
051     * The member {@code alternativeRef}. A document-local reference: an integer that is unique
052     * across the whole document (one reference space for every object that carries a ref). Local
053     * references are assigned after merging and have no meaning outside the document (Sections 6.1
054     * and 13). Null when absent; throws IllegalStateException when the member holds another JSON
055     * type.
056     */
057    public Long getAlternativeRef() {
058        return integer("alternativeRef");
059    }
060
061    /**
062     * The member {@code candidateRef}. A document-local reference: an integer that is unique across
063     * the whole document (one reference space for every object that carries a ref). Local
064     * references are assigned after merging and have no meaning outside the document (Sections 6.1
065     * and 13). Null when absent; throws IllegalStateException when the member holds another JSON
066     * type.
067     */
068    public Long getCandidateRef() {
069        return integer("candidateRef");
070    }
071
072    /** Collects the members of a new {@code CandidateAlignment}. */
073    public static final class Builder extends SqllrObject.Builder<CandidateAlignment, Builder> {
074        private Builder(Map<String, Object> from) {
075            super(from);
076        }
077
078        /** Sets the member {@code alternativeRef}; null removes it. */
079        public Builder alternativeRef(Long value) {
080            return set("alternativeRef", value);
081        }
082
083        /** Sets the member {@code candidateRef}; null removes it. */
084        public Builder candidateRef(Long value) {
085            return set("candidateRef", value);
086        }
087
088        @Override
089        public CandidateAlignment build() {
090            return new CandidateAlignment(frozenMembers());
091        }
092    }
093}