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 * How the raw bytes were decoded into the text that positions count in. Generated from the schema
010 * definition Decoding by scripts/sqllr/gen_type_model.py; do not edit.
011 *
012 * @since 4.2.17
013 */
014public final class Decoding extends SqllrObject {
015
016    /** The members the schema defines, in schema order. */
017    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("encoding", "bom", "lineEndings"));
018
019    /** The members the schema requires. */
020    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("encoding", "bom", "lineEndings"));
021
022    /** Reads a JSON object as a {@code Decoding}. */
023    public static final Reader<Decoding> READER = new Reader<Decoding>() {
024        @Override
025        public Decoding read(Object json) {
026            return fromJson(json);
027        }
028    };
029
030    private Decoding(Map<String, Object> members) {
031        super(members);
032    }
033
034    /** A {@code Decoding} with the members of a JSON object, all kept. */
035    public static Decoding fromJson(Object json) {
036        return new Decoding(members(json, "Decoding"));
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 encoding}. The character encoding (IANA charset name), such as UTF-8. Null
050     * when absent; throws IllegalStateException when the member holds another JSON type.
051     */
052    public String getEncoding() {
053        return string("encoding");
054    }
055
056    /**
057     * The member {@code bom}. How a byte order mark is handled. Registry group 'bomHandling'
058     * (Section 7.8). Null when absent; throws IllegalStateException when the member holds another
059     * JSON type.
060     */
061    public String getBom() {
062        return string("bom");
063    }
064
065    /**
066     * The member {@code lineEndings}. How line endings are handled. Registry group
067     * 'lineEndingHandling' (Section 7.8). Null when absent; throws IllegalStateException when the
068     * member holds another JSON type.
069     */
070    public String getLineEndings() {
071        return string("lineEndings");
072    }
073
074    /** Collects the members of a new {@code Decoding}. */
075    public static final class Builder extends SqllrObject.Builder<Decoding, Builder> {
076        private Builder(Map<String, Object> from) {
077            super(from);
078        }
079
080        /** Sets the member {@code encoding}; null removes it. */
081        public Builder encoding(String value) {
082            return set("encoding", value);
083        }
084
085        /** Sets the member {@code bom}; null removes it. */
086        public Builder bom(String value) {
087            return set("bom", value);
088        }
089
090        /** Sets the member {@code lineEndings}; null removes it. */
091        public Builder lineEndings(String value) {
092            return set("lineEndings", value);
093        }
094
095        @Override
096        public Decoding build() {
097            return new Decoding(frozenMembers());
098        }
099    }
100}