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.path;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import org.opendaylight.yangtools.yang.model.util.AbstractPathExpression;
14 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ArgumentUtils;
15 import org.opendaylight.yangtools.yang.xpath.api.YangLocationPath;
17 final class UnparsedPathExpression extends AbstractPathExpression {
18 private final RuntimeException cause;
19 private final boolean absolute;
21 UnparsedPathExpression(final String originalString, final RuntimeException cause) {
22 super(originalString);
23 this.cause = requireNonNull(cause);
24 absolute = ArgumentUtils.isAbsoluteXPath(originalString);
28 public boolean isAbsolute() {
33 public YangLocationPath getLocation() {
34 throw new UnsupportedOperationException("Expression '" + getOriginalString() + "' was not parsed", cause);
38 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
39 return super.addToStringAttributes(helper.add("absolute", absolute)).add("cause", cause);