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 overload identity of a routine (Section 7.3). Module routines. Generated from the schema
010 * definition Signature by scripts/sqllr/gen_type_model.py; do not edit.
011 *
012 * @since 4.2.17
013 */
014public final class Signature extends SqllrObject {
015
016    /** The members the schema defines, in schema order. */
017    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("form", "parameters", "overloadId"));
018
019    /** The members the schema requires. */
020    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("form"));
021
022    /** Reads a JSON object as a {@code Signature}. */
023    public static final Reader<Signature> READER = new Reader<Signature>() {
024        @Override
025        public Signature read(Object json) {
026            return fromJson(json);
027        }
028    };
029
030    private Signature(Map<String, Object> members) {
031        super(members);
032    }
033
034    /** A {@code Signature} with the members of a JSON object, all kept. */
035    public static Signature fromJson(Object json) {
036        return new Signature(members(json, "Signature"));
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 form}. How the overload of a routine is identified. Registry group
050     * 'signatureForms' (Section 7.3). Null when absent; throws IllegalStateException when the
051     * member holds another JSON type.
052     */
053    public String getForm() {
054        return string("form");
055    }
056
057    /**
058     * The member {@code parameters}. Null when absent; throws IllegalStateException when the member
059     * holds another JSON type.
060     */
061    public List<Map<String, Object>> getParameters() {
062        return typed("parameters", listOf(OBJECT));
063    }
064
065    /**
066     * The member {@code overloadId}. Null when absent; throws IllegalStateException when the member
067     * holds another JSON type.
068     */
069    public String getOverloadId() {
070        return string("overloadId");
071    }
072
073    /** Collects the members of a new {@code Signature}. */
074    public static final class Builder extends SqllrObject.Builder<Signature, Builder> {
075        private Builder(Map<String, Object> from) {
076            super(from);
077        }
078
079        /** Sets the member {@code form}; null removes it. */
080        public Builder form(String value) {
081            return set("form", value);
082        }
083
084        /** Sets the member {@code parameters}; null removes it. */
085        public Builder parameters(List<Map<String, Object>> value) {
086            return set("parameters", value);
087        }
088
089        /** Sets the member {@code overloadId}; null removes it. */
090        public Builder overloadId(String value) {
091            return set("overloadId", value);
092        }
093
094        @Override
095        public Signature build() {
096            return new Signature(frozenMembers());
097        }
098    }
099}