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 fold walk that yields the Occurrence (or the Occurrence of a FactCandidate) that lists it in
010 * supportPathRefs (algorithms/fold-v1.md, Section 8.2). Generated from the schema definition
011 * SupportPath by scripts/sqllr/gen_type_model.py; do not edit.
012 *
013 * @since 4.2.17
014 */
015public final class SupportPath extends SqllrObject {
016
017    /** The members the schema defines, in schema order. */
018    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("ref", "microEdgeRefs", "extensions"));
019
020    /** The members the schema requires. */
021    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("ref", "microEdgeRefs"));
022
023    /** Reads a JSON object as a {@code SupportPath}. */
024    public static final Reader<SupportPath> READER = new Reader<SupportPath>() {
025        @Override
026        public SupportPath read(Object json) {
027            return fromJson(json);
028        }
029    };
030
031    private SupportPath(Map<String, Object> members) {
032        super(members);
033    }
034
035    /** A {@code SupportPath} with the members of a JSON object, all kept. */
036    public static SupportPath fromJson(Object json) {
037        return new SupportPath(members(json, "SupportPath"));
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 ref}. A document-local reference: an integer that is unique across the
051     * whole document (one reference space for every object that carries a ref). Local references
052     * are assigned after merging and have no meaning outside the document (Sections 6.1 and 13).
053     * Null when absent; throws IllegalStateException when the member holds another JSON type.
054     */
055    public Long getRef() {
056        return integer("ref");
057    }
058
059    /**
060     * The member {@code microEdgeRefs}. The micro-edges of the walk, from the kept source to the
061     * kept target. A walk may repeat edges and nodes. Null when absent; throws
062     * IllegalStateException when the member holds another JSON type.
063     */
064    public List<Long> getMicroEdgeRefs() {
065        return typed("microEdgeRefs", listOf(INTEGER));
066    }
067
068    /**
069     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
070     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
071     * when the member holds another JSON type.
072     */
073    public Map<String, Extension> getExtensions() {
074        return typed("extensions", mapOf(Extension.READER));
075    }
076
077    /** Collects the members of a new {@code SupportPath}. */
078    public static final class Builder extends SqllrObject.Builder<SupportPath, Builder> {
079        private Builder(Map<String, Object> from) {
080            super(from);
081        }
082
083        /** Sets the member {@code ref}; null removes it. */
084        public Builder ref(Long value) {
085            return set("ref", value);
086        }
087
088        /** Sets the member {@code microEdgeRefs}; null removes it. */
089        public Builder microEdgeRefs(List<Long> value) {
090            return set("microEdgeRefs", value);
091        }
092
093        /** Sets the member {@code extensions}; null removes it. */
094        public Builder extensions(Map<String, Extension> value) {
095            return set("extensions", value);
096        }
097
098        @Override
099        public SupportPath build() {
100            return new SupportPath(frozenMembers());
101        }
102    }
103}