Use pattern matching on instanceof in NormalizedNodeWriter
[yangtools.git] / data / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / YangNetconfError.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.data.api;
9
10 import com.google.common.annotations.Beta;
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import java.util.List;
13 import javax.annotation.processing.Generated;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.immutables.value.Value;
17 import org.opendaylight.yangtools.yang.common.ErrorSeverity;
18 import org.opendaylight.yangtools.yang.common.ErrorTag;
19 import org.opendaylight.yangtools.yang.common.ErrorType;
20
21 /**
22  * Baseline interface for metadata associated with a NETCONF notion of an 'error'. Except what NETCONF regards as
23  * an 'error', really means 'notable event' in that it can either be a warning or an error. No warnings were defined
24  * at the time this distinction was made.
25  */
26 @Beta
27 @NonNullByDefault
28 @Value.Immutable(copy = false)
29 @Value.Style(stagedBuilder = true, allowedClasspathAnnotations = {
30     SuppressWarnings.class, Generated.class, SuppressFBWarnings.class,
31 })
32 // FIXME: 8.0.0: Split this interface into two:
33 //               - yang.common.NetconfError, which does not have a builder sets up the stage
34 //               - data.api.schema.NormalizedNetconfError
35 public interface YangNetconfError {
36     /**
37      * Return this error's severity.
38      *
39      * @return Error severity.
40      */
41     ErrorSeverity severity();
42
43     /**
44      * Return this error's type.
45      *
46      * @return Error type.
47      */
48     ErrorType type();
49
50     /**
51      * Return this error's tag.
52      *
53      * @return Error tag.
54      */
55     ErrorTag tag();
56
57     /**
58      * Return this errors's {@code error-message}, if available. This value is expected to be defined in a YANG model
59      * through a {@code error-message} statement.
60      *
61      * @return Event message, or null.
62      */
63     @Nullable String message();
64
65     /**
66      * Return this error's {@code error-app-tag}, if available. This value is expected to be defined in a YANG model
67      * through a {@code error-app-tag} statement.
68      *
69      * @return Application tag, or null.
70      */
71     @Nullable String appTag();
72
73     /**
74      * Return the path which triggered this error, if available.
75      *
76      * @return Triggering path, or null.
77      */
78     // FIXME: 8.0.0: yang.common returns concepts.HierarchicalIdentifier<?>
79     @Nullable YangInstanceIdentifier path();
80
81     /**
82      * Return this error's additional info.
83      *
84      * @return Additional info.
85      */
86     // FIXME: 8.0.0: return NetconfErrorInfoRepresentation
87     List<YangErrorInfo> info();
88 }