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 segmented name, outermost segment first. Dataset, routine and other top-level endpoints carry 010 * their full name, whose first segment has role AUTHORITY (the authority domain); a FIELD carries 011 * only its own segment, relative to its owner (registry/qualification-profiles.json). Generated 012 * from the schema definition Name by scripts/sqllr/gen_type_model.py; do not edit. 013 * 014 * @since 4.2.17 015 */ 016public final class Name extends SqllrObject { 017 018 /** The members the schema defines, in schema order. */ 019 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("segments")); 020 021 /** The members the schema requires. */ 022 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("segments")); 023 024 /** Reads a JSON object as a {@code Name}. */ 025 public static final Reader<Name> READER = new Reader<Name>() { 026 @Override 027 public Name read(Object json) { 028 return fromJson(json); 029 } 030 }; 031 032 private Name(Map<String, Object> members) { 033 super(members); 034 } 035 036 /** A {@code Name} with the members of a JSON object, all kept. */ 037 public static Name fromJson(Object json) { 038 return new Name(members(json, "Name")); 039 } 040 041 public static Builder builder() { 042 return new Builder(null); 043 } 044 045 /** A builder holding every member of this object. */ 046 public Builder toBuilder() { 047 return new Builder(toJson()); 048 } 049 050 /** 051 * The member {@code segments}. Null when absent; throws IllegalStateException when the member 052 * holds another JSON type. 053 */ 054 public List<NameSegment> getSegments() { 055 return typed("segments", listOf(NameSegment.READER)); 056 } 057 058 /** Collects the members of a new {@code Name}. */ 059 public static final class Builder extends SqllrObject.Builder<Name, Builder> { 060 private Builder(Map<String, Object> from) { 061 super(from); 062 } 063 064 /** Sets the member {@code segments}; null removes it. */ 065 public Builder segments(List<NameSegment> value) { 066 return set("segments", value); 067 } 068 069 @Override 070 public Name build() { 071 return new Name(frozenMembers()); 072 } 073 } 074}