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