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 redaction context (Sections 4.5 and 14.3, item 6). Redaction happens before any object of 010 * this specification is constructed. Generated from the schema definition Redaction by 011 * scripts/sqllr/gen_type_model.py; do not edit. 012 * 013 * @since 4.2.17 014 */ 015public final class Redaction extends SqllrObject { 016 017 /** The members the schema defines, in schema order. */ 018 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("policyId", "policyVersion", "tokenDomain", "publishedDigestDomains", "extensions")); 019 020 /** The members the schema requires. */ 021 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("policyId", "policyVersion")); 022 023 /** Reads a JSON object as a {@code Redaction}. */ 024 public static final Reader<Redaction> READER = new Reader<Redaction>() { 025 @Override 026 public Redaction read(Object json) { 027 return fromJson(json); 028 } 029 }; 030 031 private Redaction(Map<String, Object> members) { 032 super(members); 033 } 034 035 /** A {@code Redaction} with the members of a JSON object, all kept. */ 036 public static Redaction fromJson(Object json) { 037 return new Redaction(members(json, "Redaction")); 038 } 039 040 public static Builder builder() { 041 return new Builder(null); 042 } 043 044 /** A builder holding every member of this object. */ 045 public Builder toBuilder() { 046 return new Builder(toJson()); 047 } 048 049 /** 050 * The member {@code policyId}. Null when absent; throws IllegalStateException when the member 051 * holds another JSON type. 052 */ 053 public String getPolicyId() { 054 return string("policyId"); 055 } 056 057 /** 058 * The member {@code policyVersion}. Null when absent; throws IllegalStateException when the 059 * member holds another JSON type. 060 */ 061 public String getPolicyVersion() { 062 return string("policyVersion"); 063 } 064 065 /** 066 * The member {@code tokenDomain}. The comparison domain of the keyed tokens the document 067 * carries. Equal tokens from different domains do not denote the same value. Null when absent; 068 * throws IllegalStateException when the member holds another JSON type. 069 */ 070 public String getTokenDomain() { 071 return string("tokenDomain"); 072 } 073 074 /** 075 * The member {@code publishedDigestDomains}. The digest domains the policy allows the document 076 * to publish. Null when absent; throws IllegalStateException when the member holds another JSON 077 * type. 078 */ 079 public List<String> getPublishedDigestDomains() { 080 return typed("publishedDigestDomains", listOf(STRING)); 081 } 082 083 /** 084 * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry 085 * it; it never takes part in a core identity. Null when absent; throws IllegalStateException 086 * when the member holds another JSON type. 087 */ 088 public Map<String, Extension> getExtensions() { 089 return typed("extensions", mapOf(Extension.READER)); 090 } 091 092 /** Collects the members of a new {@code Redaction}. */ 093 public static final class Builder extends SqllrObject.Builder<Redaction, Builder> { 094 private Builder(Map<String, Object> from) { 095 super(from); 096 } 097 098 /** Sets the member {@code policyId}; null removes it. */ 099 public Builder policyId(String value) { 100 return set("policyId", value); 101 } 102 103 /** Sets the member {@code policyVersion}; null removes it. */ 104 public Builder policyVersion(String value) { 105 return set("policyVersion", value); 106 } 107 108 /** Sets the member {@code tokenDomain}; null removes it. */ 109 public Builder tokenDomain(String value) { 110 return set("tokenDomain", value); 111 } 112 113 /** Sets the member {@code publishedDigestDomains}; null removes it. */ 114 public Builder publishedDigestDomains(List<String> value) { 115 return set("publishedDigestDomains", value); 116 } 117 118 /** Sets the member {@code extensions}; null removes it. */ 119 public Builder extensions(Map<String, Extension> value) { 120 return set("extensions", value); 121 } 122 123 @Override 124 public Redaction build() { 125 return new Redaction(frozenMembers()); 126 } 127 } 128}