From: Robert Varga Date: Sat, 23 Oct 2021 22:33:39 +0000 (+0200) Subject: Improve UnresolvedQNameReferent X-Git-Tag: v8.0.0~181 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=e00e8bfb37ca7de1c3489b59b166d8dd15f20323;p=yangtools.git Improve UnresolvedQNameReferent We now have UnresolvedQName, use it to mark that the required return type. Since the two specializations now clash on return type, the two interfaces cannot be implemented even without QNameReferentBehavior magic. Change-Id: I1da5a8df89c5dfe64c815a1cd5158d2f60c0b1da Signed-off-by: Robert Varga --- diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java deleted file mode 100644 index 94fed8f791..0000000000 --- a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/QNameReferentBehavior.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2019 PANTHEON.tech, s.r.o. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.xpath.api; - -/** - * Common interface for {@link ResolvedQNameReferent} and {@link UnresolvedQNameReferent}, ensuring that only one of - * them is implemented by any class. - * - * @param {@link QNameReferent} behavior subclass - */ -interface QNameReferentBehavior> extends QNameReferent { - -} diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/ResolvedQNameReferent.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/ResolvedQNameReferent.java index b17046fcd2..92b454aa0b 100644 --- a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/ResolvedQNameReferent.java +++ b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/ResolvedQNameReferent.java @@ -16,7 +16,7 @@ import org.opendaylight.yangtools.yang.common.QName; * @author Robert Varga */ @Beta -public interface ResolvedQNameReferent extends QNameReferentBehavior { +public interface ResolvedQNameReferent extends QNameReferent { /** * Return the referenced QName. * diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/UnresolvedQNameReferent.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/UnresolvedQNameReferent.java index 5d6a6c0e16..c9e74dfb71 100644 --- a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/UnresolvedQNameReferent.java +++ b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/UnresolvedQNameReferent.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.yang.xpath.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.UnresolvedQName; /** * A {@link QNameReferent} referencing an unresolved QName. @@ -15,7 +16,7 @@ import com.google.common.annotations.Beta; * @author Robert Varga */ @Beta -public interface UnresolvedQNameReferent extends - QNameReferentBehavior> { - +public interface UnresolvedQNameReferent extends QNameReferent { + @Override + UnresolvedQName getQName(); } diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangLocationPath.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangLocationPath.java index b4134d7ce8..4cbd35c55e 100644 --- a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangLocationPath.java +++ b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangLocationPath.java @@ -243,7 +243,7 @@ public abstract class YangLocationPath implements YangExpr { } public static class UnresolvedQNameStep extends AbstractQNameStep - implements UnresolvedQNameReferent { + implements UnresolvedQNameReferent { private static final long serialVersionUID = 1L; UnresolvedQNameStep(final YangXPathAxis axis, final UnresolvedQName qname) { diff --git a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangQNameExpr.java b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangQNameExpr.java index e8e35f5195..4735055164 100644 --- a/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangQNameExpr.java +++ b/xpath/yang-xpath-api/src/main/java/org/opendaylight/yangtools/yang/xpath/api/YangQNameExpr.java @@ -57,7 +57,7 @@ public abstract class YangQNameExpr implements YangExpr, QNameReferent { } } - public static final class Unresolved extends YangQNameExpr implements UnresolvedQNameReferent { + public static final class Unresolved extends YangQNameExpr implements UnresolvedQNameReferent { private static final long serialVersionUID = 1L; private final UnresolvedQName qname;