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 position in the decoded text of a source unit. Generated from the schema definition Position by
010 * scripts/sqllr/gen_type_model.py; do not edit.
011 *
012 * @since 4.2.17
013 */
014public final class Position extends SqllrObject {
015
016    /** The members the schema defines, in schema order. */
017    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("line1", "column1", "utf8ByteOffset0", "utf16Offset0"));
018
019    /** The members the schema requires. */
020    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("line1", "column1", "utf8ByteOffset0"));
021
022    /** Reads a JSON object as a {@code Position}. */
023    public static final Reader<Position> READER = new Reader<Position>() {
024        @Override
025        public Position read(Object json) {
026            return fromJson(json);
027        }
028    };
029
030    private Position(Map<String, Object> members) {
031        super(members);
032    }
033
034    /** A {@code Position} with the members of a JSON object, all kept. */
035    public static Position fromJson(Object json) {
036        return new Position(members(json, "Position"));
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 line1}. 1-based line number. Null when absent; throws IllegalStateException
050     * when the member holds another JSON type.
051     */
052    public Long getLine1() {
053        return integer("line1");
054    }
055
056    /**
057     * The member {@code column1}. 1-based column number. Null when absent; throws
058     * IllegalStateException when the member holds another JSON type.
059     */
060    public Long getColumn1() {
061        return integer("column1");
062    }
063
064    /**
065     * The member {@code utf8ByteOffset0}. 0-based UTF-8 byte offset in the decoded text. A 0-based
066     * ordinal. Null when absent; throws IllegalStateException when the member holds another JSON
067     * type.
068     */
069    public Long getUtf8ByteOffset0() {
070        return integer("utf8ByteOffset0");
071    }
072
073    /**
074     * The member {@code utf16Offset0}. 0-based UTF-16 code-unit offset. Module exact-spans. A
075     * 0-based ordinal. Null when absent; throws IllegalStateException when the member holds another
076     * JSON type.
077     */
078    public Long getUtf16Offset0() {
079        return integer("utf16Offset0");
080    }
081
082    /** Collects the members of a new {@code Position}. */
083    public static final class Builder extends SqllrObject.Builder<Position, Builder> {
084        private Builder(Map<String, Object> from) {
085            super(from);
086        }
087
088        /** Sets the member {@code line1}; null removes it. */
089        public Builder line1(Long value) {
090            return set("line1", value);
091        }
092
093        /** Sets the member {@code column1}; null removes it. */
094        public Builder column1(Long value) {
095            return set("column1", value);
096        }
097
098        /** Sets the member {@code utf8ByteOffset0}; null removes it. */
099        public Builder utf8ByteOffset0(Long value) {
100            return set("utf8ByteOffset0", value);
101        }
102
103        /** Sets the member {@code utf16Offset0}; null removes it. */
104        public Builder utf16Offset0(Long value) {
105            return set("utf16Offset0", value);
106        }
107
108        @Override
109        public Position build() {
110            return new Position(frozenMembers());
111        }
112    }
113}