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 SQL dialect of the input. Generated from the schema definition Dialect by 010 * scripts/sqllr/gen_type_model.py; do not edit. 011 * 012 * @since 4.2.17 013 */ 014public final class Dialect extends SqllrObject { 015 016 /** The members the schema defines, in schema order. */ 017 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("id", "version", "extensions")); 018 019 /** The members the schema requires. */ 020 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("id")); 021 022 /** Reads a JSON object as a {@code Dialect}. */ 023 public static final Reader<Dialect> READER = new Reader<Dialect>() { 024 @Override 025 public Dialect read(Object json) { 026 return fromJson(json); 027 } 028 }; 029 030 private Dialect(Map<String, Object> members) { 031 super(members); 032 } 033 034 /** A {@code Dialect} with the members of a JSON object, all kept. */ 035 public static Dialect fromJson(Object json) { 036 return new Dialect(members(json, "Dialect")); 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 id}. A dialect id of the identifier-rule data of the declared dependency 050 * snapshot, such as oracle or sqlserver. Null when absent; throws IllegalStateException when 051 * the member holds another JSON type. 052 */ 053 public String getId() { 054 return string("id"); 055 } 056 057 /** 058 * The member {@code version}. The dialect or server version the analysis assumed, when it 059 * matters. Null when absent; throws IllegalStateException when the member holds another JSON 060 * type. 061 */ 062 public String getVersion() { 063 return string("version"); 064 } 065 066 /** 067 * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry 068 * it; it never takes part in a core identity. Null when absent; throws IllegalStateException 069 * when the member holds another JSON type. 070 */ 071 public Map<String, Extension> getExtensions() { 072 return typed("extensions", mapOf(Extension.READER)); 073 } 074 075 /** Collects the members of a new {@code Dialect}. */ 076 public static final class Builder extends SqllrObject.Builder<Dialect, Builder> { 077 private Builder(Map<String, Object> from) { 078 super(from); 079 } 080 081 /** Sets the member {@code id}; null removes it. */ 082 public Builder id(String value) { 083 return set("id", value); 084 } 085 086 /** Sets the member {@code version}; null removes it. */ 087 public Builder version(String value) { 088 return set("version", value); 089 } 090 091 /** Sets the member {@code extensions}; null removes it. */ 092 public Builder extensions(Map<String, Extension> value) { 093 return set("extensions", value); 094 } 095 096 @Override 097 public Dialect build() { 098 return new Dialect(frozenMembers()); 099 } 100 } 101}