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 name binding of one endpoint of an Occurrence (Contract 2, Section 4.2), with the declaration
010 * basis observed by this assertion. Generated from the schema definition Binding by
011 * scripts/sqllr/gen_type_model.py; do not edit.
012 *
013 * @since 4.2.17
014 */
015public final class Binding extends SqllrObject {
016
017    /** The members the schema defines, in schema order. */
018    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("status", "bases", "scopeRef", "declarationRef", "candidateSetRef", "declarationBasis", "extensions"));
019
020    /** The members the schema requires. */
021    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("status", "bases", "scopeRef"));
022
023    /** Reads a JSON object as a {@code Binding}. */
024    public static final Reader<Binding> READER = new Reader<Binding>() {
025        @Override
026        public Binding read(Object json) {
027            return fromJson(json);
028        }
029    };
030
031    private Binding(Map<String, Object> members) {
032        super(members);
033    }
034
035    /** A {@code Binding} with the members of a JSON object, all kept. */
036    public static Binding fromJson(Object json) {
037        return new Binding(members(json, "Binding"));
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 status}. The status of a name binding. Registry group 'bindingStatus'
051     * (Section 4.2). Null when absent; throws IllegalStateException when the member holds another
052     * JSON type.
053     */
054    public String getStatus() {
055        return string("status");
056    }
057
058    /**
059     * The member {@code bases}. Null when absent; throws IllegalStateException when the member
060     * holds another JSON type.
061     */
062    public List<String> getBases() {
063        return typed("bases", listOf(STRING));
064    }
065
066    /**
067     * The member {@code scopeRef}. The scope in which the reference was resolved. A document-local
068     * reference: an integer that is unique across the whole document (one reference space for every
069     * object that carries a ref). Local references are assigned after merging and have no meaning
070     * outside the document (Sections 6.1 and 13). Null when absent; throws IllegalStateException
071     * when the member holds another JSON type.
072     */
073    public Long getScopeRef() {
074        return integer("scopeRef");
075    }
076
077    /**
078     * The member {@code declarationRef}. The statement that declares the bound name, when the basis
079     * is a declaration in the input. A document-local reference: an integer that is unique across
080     * the whole document (one reference space for every object that carries a ref). Local
081     * references are assigned after merging and have no meaning outside the document (Sections 6.1
082     * and 13). Null when absent; throws IllegalStateException when the member holds another JSON
083     * type.
084     */
085    public Long getDeclarationRef() {
086        return integer("declarationRef");
087    }
088
089    /**
090     * The member {@code candidateSetRef}. The candidate set of a CANDIDATE or UNRESOLVED binding. A
091     * document-local reference: an integer that is unique across the whole document (one reference
092     * space for every object that carries a ref). Local references are assigned after merging and
093     * have no meaning outside the document (Sections 6.1 and 13). Null when absent; throws
094     * IllegalStateException when the member holds another JSON type.
095     */
096    public Long getCandidateSetRef() {
097        return integer("candidateSetRef");
098    }
099
100    /**
101     * The member {@code declarationBasis}. Required when the endpoint is a FIELD (semantic stage:
102     * SEMANTIC_DECLARATION_BASIS_MISSING). The declaration basis of a field endpoint. Registry
103     * group 'declarationBasis' (Section 4.2). Null when absent; throws IllegalStateException when
104     * the member holds another JSON type.
105     */
106    public String getDeclarationBasis() {
107        return string("declarationBasis");
108    }
109
110    /**
111     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
112     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
113     * when the member holds another JSON type.
114     */
115    public Map<String, Extension> getExtensions() {
116        return typed("extensions", mapOf(Extension.READER));
117    }
118
119    /** Collects the members of a new {@code Binding}. */
120    public static final class Builder extends SqllrObject.Builder<Binding, Builder> {
121        private Builder(Map<String, Object> from) {
122            super(from);
123        }
124
125        /** Sets the member {@code status}; null removes it. */
126        public Builder status(String value) {
127            return set("status", value);
128        }
129
130        /** Sets the member {@code bases}; null removes it. */
131        public Builder bases(List<String> value) {
132            return set("bases", value);
133        }
134
135        /** Sets the member {@code scopeRef}; null removes it. */
136        public Builder scopeRef(Long value) {
137            return set("scopeRef", value);
138        }
139
140        /** Sets the member {@code declarationRef}; null removes it. */
141        public Builder declarationRef(Long value) {
142            return set("declarationRef", value);
143        }
144
145        /** Sets the member {@code candidateSetRef}; null removes it. */
146        public Builder candidateSetRef(Long value) {
147            return set("candidateSetRef", value);
148        }
149
150        /** Sets the member {@code declarationBasis}; null removes it. */
151        public Builder declarationBasis(String value) {
152            return set("declarationBasis", value);
153        }
154
155        /** Sets the member {@code extensions}; null removes it. */
156        public Builder extensions(Map<String, Extension> value) {
157            return set("extensions", value);
158        }
159
160        @Override
161        public Binding build() {
162            return new Binding(frozenMembers());
163        }
164    }
165}