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 * One serving truncation. Generated from the schema definition Truncation by 010 * scripts/sqllr/gen_type_model.py; do not edit. 011 * 012 * @since 4.2.17 013 */ 014public final class Truncation extends SqllrObject { 015 016 /** The members the schema defines, in schema order. */ 017 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("reason", "budget", "continuationToken", "extensions")); 018 019 /** The members the schema requires. */ 020 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("reason")); 021 022 /** Reads a JSON object as a {@code Truncation}. */ 023 public static final Reader<Truncation> READER = new Reader<Truncation>() { 024 @Override 025 public Truncation read(Object json) { 026 return fromJson(json); 027 } 028 }; 029 030 private Truncation(Map<String, Object> members) { 031 super(members); 032 } 033 034 /** A {@code Truncation} with the members of a JSON object, all kept. */ 035 public static Truncation fromJson(Object json) { 036 return new Truncation(members(json, "Truncation")); 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 reason}. Why a served result was truncated. Registry group 050 * 'truncationReasons' (Section 4.4). Null when absent; throws IllegalStateException when the 051 * member holds another JSON type. 052 */ 053 public String getReason() { 054 return string("reason"); 055 } 056 057 /** 058 * The member {@code budget}. The budget that was exhausted. Null when absent; throws 059 * IllegalStateException when the member holds another JSON type. 060 */ 061 public Map<String, Object> getBudget() { 062 return object("budget"); 063 } 064 065 /** 066 * The member {@code continuationToken}. An opaque token to request the next part. Null when 067 * absent; throws IllegalStateException when the member holds another JSON type. 068 */ 069 public String getContinuationToken() { 070 return string("continuationToken"); 071 } 072 073 /** 074 * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry 075 * it; it never takes part in a core identity. Null when absent; throws IllegalStateException 076 * when the member holds another JSON type. 077 */ 078 public Map<String, Extension> getExtensions() { 079 return typed("extensions", mapOf(Extension.READER)); 080 } 081 082 /** Collects the members of a new {@code Truncation}. */ 083 public static final class Builder extends SqllrObject.Builder<Truncation, Builder> { 084 private Builder(Map<String, Object> from) { 085 super(from); 086 } 087 088 /** Sets the member {@code reason}; null removes it. */ 089 public Builder reason(String value) { 090 return set("reason", value); 091 } 092 093 /** Sets the member {@code budget}; null removes it. */ 094 public Builder budget(Map<String, Object> value) { 095 return set("budget", value); 096 } 097 098 /** Sets the member {@code continuationToken}; null removes it. */ 099 public Builder continuationToken(String value) { 100 return set("continuationToken", value); 101 } 102 103 /** Sets the member {@code extensions}; null removes it. */ 104 public Builder extensions(Map<String, Extension> value) { 105 return set("extensions", value); 106 } 107 108 @Override 109 public Truncation build() { 110 return new Truncation(frozenMembers()); 111 } 112 } 113}