2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.parser.rfc7950.stmt;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath.WithExpression;
15 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
16 import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression.QualifiedBound;
18 // TODO: disconnect from RevisionAwareXPathImpl
19 // FIXME: absolute should not be needed: since the expression is qualified, we known how to interpret it
20 // FIXME: originalString() is an escape hatch: everybody should operate of QualifiedBound
22 final class WithExpressionImpl extends RevisionAwareXPathImpl implements WithExpression {
23 private final QualifiedBound xpathExpression;
25 WithExpressionImpl(final String xpath, final boolean absolute, final QualifiedBound xpathExpression) {
26 super(xpath, absolute);
27 this.xpathExpression = requireNonNull(xpathExpression);
31 public QualifiedBound getXPathExpression() {
32 return xpathExpression;
36 public String toString() {
37 return MoreObjects.toStringHelper(this).add("xpath", getOriginalString()).toString();