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.model.util;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.eclipse.jdt.annotation.Nullable;
18 * A simple XPathExpression implementation.
20 * @deprecated Users are advised to supply their own implementation of PathExpression.
22 @Deprecated(forRemoval = true)
24 public final class PathExpressionImpl extends AbstractPathExpression {
25 private final @Nullable Steps steps;
26 private final boolean absolute;
28 @SuppressFBWarnings(value = "NP_STORE_INTO_NONNULL_FIELD", justification = "Non-grok on SpotBugs part")
29 public PathExpressionImpl(final String xpath, final boolean absolute) {
31 this.absolute = absolute;
35 public PathExpressionImpl(final String xpath, final Steps steps) {
37 this.steps = requireNonNull(steps);
38 this.absolute = steps instanceof LocationPathSteps
39 && ((LocationPathSteps) steps).getLocationPath().isAbsolute();
43 public boolean isAbsolute() {
48 public Steps getSteps() {
49 final Steps loc = steps;
51 throw new UnsupportedOperationException("Steps have not been provided");
57 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
58 return super.addToStringAttributes(helper.add("absolute", absolute).add("steps", steps));