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 source endpoint and a target endpoint of a FactCandidate's ends: the proposition source -> 010 * target. Generated from the schema definition CandidatePair by scripts/sqllr/gen_type_model.py; do 011 * not edit. 012 * 013 * @since 4.2.17 014 */ 015public final class CandidatePair extends SqllrObject { 016 017 /** The members the schema defines, in schema order. */ 018 public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("sourceRef", "targetRef")); 019 020 /** The members the schema requires. */ 021 public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("sourceRef", "targetRef")); 022 023 /** Reads a JSON object as a {@code CandidatePair}. */ 024 public static final Reader<CandidatePair> READER = new Reader<CandidatePair>() { 025 @Override 026 public CandidatePair read(Object json) { 027 return fromJson(json); 028 } 029 }; 030 031 private CandidatePair(Map<String, Object> members) { 032 super(members); 033 } 034 035 /** A {@code CandidatePair} with the members of a JSON object, all kept. */ 036 public static CandidatePair fromJson(Object json) { 037 return new CandidatePair(members(json, "CandidatePair")); 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 sourceRef}. A document-local reference: an integer that is unique across 051 * the whole document (one reference space for every object that carries a ref). Local 052 * references are assigned after merging and have no meaning outside the document (Sections 6.1 053 * and 13). Null when absent; throws IllegalStateException when the member holds another JSON 054 * type. 055 */ 056 public Long getSourceRef() { 057 return integer("sourceRef"); 058 } 059 060 /** 061 * The member {@code targetRef}. A document-local reference: an integer that is unique across 062 * the whole document (one reference space for every object that carries a ref). Local 063 * references are assigned after merging and have no meaning outside the document (Sections 6.1 064 * and 13). Null when absent; throws IllegalStateException when the member holds another JSON 065 * type. 066 */ 067 public Long getTargetRef() { 068 return integer("targetRef"); 069 } 070 071 /** Collects the members of a new {@code CandidatePair}. */ 072 public static final class Builder extends SqllrObject.Builder<CandidatePair, Builder> { 073 private Builder(Map<String, Object> from) { 074 super(from); 075 } 076 077 /** Sets the member {@code sourceRef}; null removes it. */ 078 public Builder sourceRef(Long value) { 079 return set("sourceRef", value); 080 } 081 082 /** Sets the member {@code targetRef}; null removes it. */ 083 public Builder targetRef(Long value) { 084 return set("targetRef", value); 085 } 086 087 @Override 088 public CandidatePair build() { 089 return new CandidatePair(frozenMembers()); 090 } 091 } 092}