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 * The completeness of the ExplainGraph of one statement. Generated from the schema definition
010 * ExplainStatementCompleteness by scripts/sqllr/gen_type_model.py; do not edit.
011 *
012 * @since 4.2.17
013 */
014public final class ExplainStatementCompleteness extends SqllrObject {
015
016    /** The members the schema defines, in schema order. */
017    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("statementRef", "completeness", "diagnosticRefs", "extensions"));
018
019    /** The members the schema requires. */
020    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("statementRef", "completeness"));
021
022    /** Reads a JSON object as a {@code ExplainStatementCompleteness}. */
023    public static final Reader<ExplainStatementCompleteness> READER = new Reader<ExplainStatementCompleteness>() {
024        @Override
025        public ExplainStatementCompleteness read(Object json) {
026            return fromJson(json);
027        }
028    };
029
030    private ExplainStatementCompleteness(Map<String, Object> members) {
031        super(members);
032    }
033
034    /** A {@code ExplainStatementCompleteness} with the members of a JSON object, all kept. */
035    public static ExplainStatementCompleteness fromJson(Object json) {
036        return new ExplainStatementCompleteness(members(json, "ExplainStatementCompleteness"));
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 statementRef}. 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 getStatementRef() {
056        return integer("statementRef");
057    }
058
059    /**
060     * The member {@code completeness}. Completeness declared by an ExplainGraph. Registry group
061     * 'explainGraphCompleteness' (Section 3.5). Null when absent; throws IllegalStateException when
062     * the member holds another JSON type.
063     */
064    public String getCompleteness() {
065        return string("completeness");
066    }
067
068    /**
069     * The member {@code diagnosticRefs}. A set of local references. Null when absent; throws
070     * IllegalStateException when the member holds another JSON type.
071     */
072    public List<Long> getDiagnosticRefs() {
073        return typed("diagnosticRefs", listOf(INTEGER));
074    }
075
076    /**
077     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
078     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
079     * when the member holds another JSON type.
080     */
081    public Map<String, Extension> getExtensions() {
082        return typed("extensions", mapOf(Extension.READER));
083    }
084
085    /** Collects the members of a new {@code ExplainStatementCompleteness}. */
086    public static final class Builder extends SqllrObject.Builder<ExplainStatementCompleteness, Builder> {
087        private Builder(Map<String, Object> from) {
088            super(from);
089        }
090
091        /** Sets the member {@code statementRef}; null removes it. */
092        public Builder statementRef(Long value) {
093            return set("statementRef", value);
094        }
095
096        /** Sets the member {@code completeness}; null removes it. */
097        public Builder completeness(String value) {
098            return set("completeness", value);
099        }
100
101        /** Sets the member {@code diagnosticRefs}; null removes it. */
102        public Builder diagnosticRefs(List<Long> value) {
103            return set("diagnosticRefs", value);
104        }
105
106        /** Sets the member {@code extensions}; null removes it. */
107        public Builder extensions(Map<String, Extension> value) {
108            return set("extensions", value);
109        }
110
111        @Override
112        public ExplainStatementCompleteness build() {
113            return new ExplainStatementCompleteness(frozenMembers());
114        }
115    }
116}