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 * A nameable persistent asset, a ROW_SET, or a document-local result (Sections 3.1, 6.3 and 9.1).
010 * The kind is an observation; EndpointIdV1 frames its identity class (registry group
011 * endpointIdentityClasses, through the attribute identityClass of group endpointKinds). Generated
012 * from the schema definition Endpoint by scripts/sqllr/gen_type_model.py; do not edit.
013 *
014 * @since 4.2.17
015 */
016public final class Endpoint extends SqllrObject {
017
018    /** The members the schema defines, in schema order. */
019    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("ref", "kind", "name", "ownerRef", "statementRef", "scopeRef", "generation", "ordinal", "resolvesToRef", "identity", "displayName", "pathSegments", "displayPath", "routineNamespace", "routineKind", "signature", "extensions"));
020
021    /** The members the schema requires. */
022    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("ref", "kind", "identity"));
023
024    /** Reads a JSON object as a {@code Endpoint}. */
025    public static final Reader<Endpoint> READER = new Reader<Endpoint>() {
026        @Override
027        public Endpoint read(Object json) {
028            return fromJson(json);
029        }
030    };
031
032    private Endpoint(Map<String, Object> members) {
033        super(members);
034    }
035
036    /** A {@code Endpoint} with the members of a JSON object, all kept. */
037    public static Endpoint fromJson(Object json) {
038        return new Endpoint(members(json, "Endpoint"));
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 ref}. A document-local reference: an integer that is unique across the
052     * whole document (one reference space for every object that carries a ref). Local references
053     * are assigned after merging and have no meaning outside the document (Sections 6.1 and 13).
054     * Null when absent; throws IllegalStateException when the member holds another JSON type.
055     */
056    public Long getRef() {
057        return integer("ref");
058    }
059
060    /**
061     * The member {@code kind}. The kind of an endpoint. Registry group 'endpointKinds' (Sections
062     * 3.1, 7.4, 9.1 and 11.1). Null when absent; throws IllegalStateException when the member holds
063     * another JSON type.
064     */
065    public String getKind() {
066        return string("kind");
067    }
068
069    /**
070     * The member {@code name}. Null when absent; throws IllegalStateException when the member holds
071     * another JSON type.
072     */
073    public Name getName() {
074        return typed("name", Name.READER);
075    }
076
077    /**
078     * The member {@code ownerRef}. The owner endpoint of a FIELD or ROW_SET, or the STAGE of a
079     * STORAGE_LOCATION. A document-local reference: an integer that is unique across the whole
080     * document (one reference space for every object that carries a ref). Local references are
081     * assigned after merging and have no meaning outside the document (Sections 6.1 and 13). Null
082     * when absent; throws IllegalStateException when the member holds another JSON type.
083     */
084    public Long getOwnerRef() {
085        return integer("ownerRef");
086    }
087
088    /**
089     * The member {@code statementRef}. The statement whose top-level result a QUERY_RESULT is, or
090     * the statement that defines a LOCAL ROUTINE (Section 7.3). A document-local reference: an
091     * integer that is unique across the whole document (one reference space for every object that
092     * carries a ref). Local references are assigned after merging and have no meaning outside the
093     * document (Sections 6.1 and 13). Null when absent; throws IllegalStateException when the
094     * member holds another JSON type.
095     */
096    public Long getStatementRef() {
097        return integer("statementRef");
098    }
099
100    /**
101     * The member {@code scopeRef}. The scope that bounds the lifetime of a local endpoint
102     * (TEMP_TABLE, TABLE_VARIABLE, CTE, VARIABLE, PARAMETER). A document-local reference: an
103     * integer that is unique across the whole document (one reference space for every object that
104     * carries a ref). Local references are assigned after merging and have no meaning outside the
105     * document (Sections 6.1 and 13). Null when absent; throws IllegalStateException when the
106     * member holds another JSON type.
107     */
108    public Long getScopeRef() {
109        return integer("scopeRef");
110    }
111
112    /**
113     * The member {@code generation}. The creation generation of a TEMP_TABLE within its scope;
114     * re-creating it after DROP gives a new generation. A 0-based ordinal. Null when absent; throws
115     * IllegalStateException when the member holds another JSON type.
116     */
117    public Long getGeneration() {
118        return integer("generation");
119    }
120
121    /**
122     * The member {@code ordinal}. The 0-based select-list position of a FIELD owned by a
123     * QUERY_RESULT. A 0-based ordinal. Null when absent; throws IllegalStateException when the
124     * member holds another JSON type.
125     */
126    public Long getOrdinal() {
127        return integer("ordinal");
128    }
129
130    /**
131     * The member {@code resolvesToRef}. For a name as written through a synonym, linked server or
132     * database link: the resolved object, when the mapping is known. Absent when it is unknown; the
133     * chain is then not connected (Section 9.1). A document-local reference: an integer that is
134     * unique across the whole document (one reference space for every object that carries a ref).
135     * Local references are assigned after merging and have no meaning outside the document
136     * (Sections 6.1 and 13). Null when absent; throws IllegalStateException when the member holds
137     * another JSON type.
138     */
139    public Long getResolvesToRef() {
140        return integer("resolvesToRef");
141    }
142
143    /**
144     * The member {@code identity}. Null when absent; throws IllegalStateException when the member
145     * holds another JSON type.
146     */
147    public Identity getIdentity() {
148        return typed("identity", Identity.READER);
149    }
150
151    /**
152     * The member {@code displayName}. Display only; never identity. Null when absent; throws
153     * IllegalStateException when the member holds another JSON type.
154     */
155    public String getDisplayName() {
156        return string("displayName");
157    }
158
159    /**
160     * The member {@code pathSegments}. Nested field path below the owner FIELD. Module
161     * nested-fields. Null when absent; throws IllegalStateException when the member holds another
162     * JSON type.
163     */
164    public List<PathSegment> getPathSegments() {
165        return typed("pathSegments", listOf(PathSegment.READER));
166    }
167
168    /**
169     * The member {@code displayPath}. Display only. Module nested-fields. Null when absent; throws
170     * IllegalStateException when the member holds another JSON type.
171     */
172    public String getDisplayPath() {
173        return string("displayPath");
174    }
175
176    /**
177     * The member {@code routineNamespace}. ROUTINE only. Module routines. The namespace of a
178     * routine identity. Registry group 'routineNamespaces' (Section 7.3). Null when absent; throws
179     * IllegalStateException when the member holds another JSON type.
180     */
181    public String getRoutineNamespace() {
182        return string("routineNamespace");
183    }
184
185    /**
186     * The member {@code routineKind}. ROUTINE only. Module routines. The kind of a routine.
187     * Registry group 'routineKinds' (Section 7.3). Null when absent; throws IllegalStateException
188     * when the member holds another JSON type.
189     */
190    public String getRoutineKind() {
191        return string("routineKind");
192    }
193
194    /**
195     * The member {@code signature}. ROUTINE only; absent while the overload is not proven. Module
196     * routines. Null when absent; throws IllegalStateException when the member holds another JSON
197     * type.
198     */
199    public Signature getSignature() {
200        return typed("signature", Signature.READER);
201    }
202
203    /**
204     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
205     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
206     * when the member holds another JSON type.
207     */
208    public Map<String, Extension> getExtensions() {
209        return typed("extensions", mapOf(Extension.READER));
210    }
211
212    /** Collects the members of a new {@code Endpoint}. */
213    public static final class Builder extends SqllrObject.Builder<Endpoint, Builder> {
214        private Builder(Map<String, Object> from) {
215            super(from);
216        }
217
218        /** Sets the member {@code ref}; null removes it. */
219        public Builder ref(Long value) {
220            return set("ref", value);
221        }
222
223        /** Sets the member {@code kind}; null removes it. */
224        public Builder kind(String value) {
225            return set("kind", value);
226        }
227
228        /** Sets the member {@code name}; null removes it. */
229        public Builder name(Name value) {
230            return set("name", value);
231        }
232
233        /** Sets the member {@code ownerRef}; null removes it. */
234        public Builder ownerRef(Long value) {
235            return set("ownerRef", value);
236        }
237
238        /** Sets the member {@code statementRef}; null removes it. */
239        public Builder statementRef(Long value) {
240            return set("statementRef", value);
241        }
242
243        /** Sets the member {@code scopeRef}; null removes it. */
244        public Builder scopeRef(Long value) {
245            return set("scopeRef", value);
246        }
247
248        /** Sets the member {@code generation}; null removes it. */
249        public Builder generation(Long value) {
250            return set("generation", value);
251        }
252
253        /** Sets the member {@code ordinal}; null removes it. */
254        public Builder ordinal(Long value) {
255            return set("ordinal", value);
256        }
257
258        /** Sets the member {@code resolvesToRef}; null removes it. */
259        public Builder resolvesToRef(Long value) {
260            return set("resolvesToRef", value);
261        }
262
263        /** Sets the member {@code identity}; null removes it. */
264        public Builder identity(Identity value) {
265            return set("identity", value);
266        }
267
268        /** Sets the member {@code displayName}; null removes it. */
269        public Builder displayName(String value) {
270            return set("displayName", value);
271        }
272
273        /** Sets the member {@code pathSegments}; null removes it. */
274        public Builder pathSegments(List<PathSegment> value) {
275            return set("pathSegments", value);
276        }
277
278        /** Sets the member {@code displayPath}; null removes it. */
279        public Builder displayPath(String value) {
280            return set("displayPath", value);
281        }
282
283        /** Sets the member {@code routineNamespace}; null removes it. */
284        public Builder routineNamespace(String value) {
285            return set("routineNamespace", value);
286        }
287
288        /** Sets the member {@code routineKind}; null removes it. */
289        public Builder routineKind(String value) {
290            return set("routineKind", value);
291        }
292
293        /** Sets the member {@code signature}; null removes it. */
294        public Builder signature(Signature value) {
295            return set("signature", value);
296        }
297
298        /** Sets the member {@code extensions}; null removes it. */
299        public Builder extensions(Map<String, Extension> value) {
300            return set("extensions", value);
301        }
302
303        @Override
304        public Endpoint build() {
305            return new Endpoint(frozenMembers());
306        }
307    }
308}