001package gudusoft.gsqlparser.lineage.v2;
002
003/**
004 * One diagnostic of a validation stage or of id recomputation: a registered code, where it was found, and a
005 * human-readable detail. The code is the contract; the location and the detail are for people.
006 *
007 * @since 4.2.17
008 */
009public final class Finding {
010
011    private final String code;
012    private final String location;
013    private final String detail;
014
015    public Finding(String code, String location, String detail) {
016        this.code = code;
017        this.location = location == null ? "" : location;
018        this.detail = detail == null ? "" : detail;
019    }
020
021    /** The registered diagnostic code. */
022    public String getCode() {
023        return code;
024    }
025
026    /** Where in the document, such as {@code $.endpoints} or {@code endpoints ref 12}. */
027    public String getLocation() {
028        return location;
029    }
030
031    public String getDetail() {
032        return detail;
033    }
034
035    @Override
036    public String toString() {
037        return code + " " + location + (detail.isEmpty() ? "" : ": " + detail);
038    }
039}