2 * Copyright (c) 2018 Pantheon Technologies, 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.xpath.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.QName;
17 public final class YangVariableReferenceExpr implements YangExpr {
18 private static final long serialVersionUID = 1L;
20 private final QName variableName;
22 private YangVariableReferenceExpr(final QName variableName) {
23 this.variableName = requireNonNull(variableName);
26 public static YangVariableReferenceExpr of(final QName variableName) {
27 return new YangVariableReferenceExpr(variableName);
30 public QName getVariableName() {
35 public int hashCode() {
36 return variableName.hashCode();
40 public boolean equals(final @Nullable Object obj) {
41 return this == obj || obj instanceof YangVariableReferenceExpr other && variableName.equals(other.variableName);
45 public String toString() {
46 return "$" + variableName;