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 keyed token valid only within its comparison domain (Section 4.5). Never an unsalted hash. 010 * Generated from the schema definition KeyedToken by scripts/sqllr/gen_type_model.py; do not edit. 011 * 012 * @since 4.2.17 013 */ 014public final class KeyedToken extends SqllrObject { 015 016 /** The members the schema defines, in schema order. */ 017 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("tokenDomain", "value")); 018 019 /** The members the schema requires. */ 020 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("tokenDomain", "value")); 021 022 /** Reads a JSON object as a {@code KeyedToken}. */ 023 public static final Reader<KeyedToken> READER = new Reader<KeyedToken>() { 024 @Override 025 public KeyedToken read(Object json) { 026 return fromJson(json); 027 } 028 }; 029 030 private KeyedToken(Map<String, Object> members) { 031 super(members); 032 } 033 034 /** A {@code KeyedToken} with the members of a JSON object, all kept. */ 035 public static KeyedToken fromJson(Object json) { 036 return new KeyedToken(members(json, "KeyedToken")); 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 tokenDomain}. Null when absent; throws IllegalStateException when the 050 * member holds another JSON type. 051 */ 052 public String getTokenDomain() { 053 return string("tokenDomain"); 054 } 055 056 /** 057 * The member {@code value}. Null when absent; throws IllegalStateException when the member 058 * holds another JSON type. 059 */ 060 public String getValue() { 061 return string("value"); 062 } 063 064 /** Collects the members of a new {@code KeyedToken}. */ 065 public static final class Builder extends SqllrObject.Builder<KeyedToken, Builder> { 066 private Builder(Map<String, Object> from) { 067 super(from); 068 } 069 070 /** Sets the member {@code tokenDomain}; null removes it. */ 071 public Builder tokenDomain(String value) { 072 return set("tokenDomain", value); 073 } 074 075 /** Sets the member {@code value}; null removes it. */ 076 public Builder value(String value) { 077 return set("value", value); 078 } 079 080 @Override 081 public KeyedToken build() { 082 return new KeyedToken(frozenMembers()); 083 } 084 } 085}