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 identifier policy that mints canonical segment keys (Section 6.3). Generated from the schema 010 * definition IdentifierPolicy by scripts/sqllr/gen_type_model.py; do not edit. 011 * 012 * @since 4.2.17 013 */ 014public final class IdentifierPolicy extends SqllrObject { 015 016 /** The members the schema defines, in schema order. */ 017 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("policyId", "extensions")); 018 019 /** The members the schema requires. */ 020 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("policyId")); 021 022 /** Reads a JSON object as a {@code IdentifierPolicy}. */ 023 public static final Reader<IdentifierPolicy> READER = new Reader<IdentifierPolicy>() { 024 @Override 025 public IdentifierPolicy read(Object json) { 026 return fromJson(json); 027 } 028 }; 029 030 private IdentifierPolicy(Map<String, Object> members) { 031 super(members); 032 } 033 034 /** A {@code IdentifierPolicy} with the members of a JSON object, all kept. */ 035 public static IdentifierPolicy fromJson(Object json) { 036 return new IdentifierPolicy(members(json, "IdentifierPolicy")); 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 policyId}. Null when absent; throws IllegalStateException when the member 050 * holds another JSON type. 051 */ 052 public String getPolicyId() { 053 return string("policyId"); 054 } 055 056 /** 057 * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry 058 * it; it never takes part in a core identity. Null when absent; throws IllegalStateException 059 * when the member holds another JSON type. 060 */ 061 public Map<String, Extension> getExtensions() { 062 return typed("extensions", mapOf(Extension.READER)); 063 } 064 065 /** Collects the members of a new {@code IdentifierPolicy}. */ 066 public static final class Builder extends SqllrObject.Builder<IdentifierPolicy, Builder> { 067 private Builder(Map<String, Object> from) { 068 super(from); 069 } 070 071 /** Sets the member {@code policyId}; null removes it. */ 072 public Builder policyId(String value) { 073 return set("policyId", value); 074 } 075 076 /** Sets the member {@code extensions}; null removes it. */ 077 public Builder extensions(Map<String, Extension> value) { 078 return set("extensions", value); 079 } 080 081 @Override 082 public IdentifierPolicy build() { 083 return new IdentifierPolicy(frozenMembers()); 084 } 085 } 086}