2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.data.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.base.MoreObjects;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
19 * An element of {@code error-info} container, as modeled in {@code errorInfoType} of
20 * <a href="https://datatracker.ietf.org/doc/html/rfc6241#appendix-B">RFC6241, Appendix B</a>.
24 // FIXME: 8.0.0: Split this into two interfaces + scenery:
25 // - yang.common.ErrorInfoRepresentation
26 // - make NormalizedNodeContainer implement ErrorInfoRepresentation
27 public final class YangErrorInfo {
28 // FIXME: 8.0.0: implies it extends ErrorInfoRepresentation, but ... perhaps NormalizedErrorInfo
29 private final DataContainerChild value;
31 private YangErrorInfo(final DataContainerChild value) {
32 this.value = requireNonNull(value);
35 public static YangErrorInfo of(final DataContainerChild value) {
36 return new YangErrorInfo(value);
39 // FIXME: 8.0.0: yang.common version returns ErrorInfoRepresentation
40 public DataContainerChild value() {
45 public int hashCode() {
46 return value.hashCode();
50 public boolean equals(final @Nullable Object obj) {
51 return obj == this || obj instanceof YangErrorInfo && value.equals(((YangErrorInfo) obj).value);
55 public String toString() {
56 return MoreObjects.toStringHelper(this).add("value", value).toString();