001package gudusoft.gsqlparser.lineage.v2.producer; 002 003import java.util.Collections; 004import java.util.List; 005import java.util.Map; 006 007import gudusoft.gsqlparser.lineage.v2.json.CanonicalJson; 008 009/** 010 * The result of one SQL-LR production run: the L1 document in canonical bytes, and, for tests and the later L2 011 * module, the internal L2 document whose ExplainGraph the Facts were folded from. Plain values only: usable after 012 * the analyzer is disposed and on any thread. 013 * 014 * @since 4.2.17 015 */ 016public final class ProducerResult { 017 018 private final byte[] document; 019 private final byte[] explained; 020 private final List<String> notes; 021 022 ProducerResult(Map<?, ?> l1, Map<?, ?> l2, List<String> notes) { 023 this.document = CanonicalJson.documentBytes(l1); 024 this.explained = CanonicalJson.documentBytes(l2); 025 this.notes = Collections.unmodifiableList(notes); 026 } 027 028 /** The L1 document, canonical bytes ({@code canonical-json-v1}, DOCUMENT mode). */ 029 public byte[] getDocument() { 030 return document.clone(); 031 } 032 033 /** The internal L2 document (core plus ExplainGraph and support paths), canonical bytes. */ 034 public byte[] getExplainedDocument() { 035 return explained.clone(); 036 } 037 038 /** Producer notes for diagnosis (not part of the document). */ 039 public List<String> getNotes() { 040 return notes; 041 } 042}