2 * Copyright (c) 2013 Cisco Systems, Inc. and others. 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.api;
10 import java.util.List;
12 import org.opendaylight.yangtools.yang.common.QName;
14 import com.google.common.collect.ImmutableList;
18 * Represents unique path to the every node inside the module.
21 public class SchemaPath {
23 * List of QName instances which represents complete path to the node.
25 private final List<QName> path;
28 * Boolean value which represents type of schema path (relative or
31 private final Boolean absolute;
34 * Constructs new instance of this class with the concrete path.
37 * list of QName instances which specifies exact path to the
40 * boolean value which specifies if the path is absolute or
43 public SchemaPath(final List<QName> path, final boolean absolute) {
44 this.path = ImmutableList.copyOf(path);
45 this.absolute = absolute;
49 * Returns the complete path to schema node.
51 * @return list of <code>QName</code> instances which represents complete
54 public List<QName> getPath() {
59 * Describes whether schema path is|isn't absolute.
61 * @return boolean value which is <code>true</code> if schema path is
64 public boolean isAbsolute() {
69 public int hashCode() {
72 result = prime * result + absolute.hashCode();
73 result = prime * result + ((path == null) ? 0 : path.hashCode());
78 public boolean equals(final Object obj) {
85 if (getClass() != obj.getClass()) {
88 SchemaPath other = (SchemaPath) obj;
89 if (absolute != other.absolute) {
93 if (other.path != null) {
96 } else if (!path.equals(other.path)) {
103 public String toString() {
104 StringBuilder builder = new StringBuilder();
105 builder.append("SchemaPath [path=");
106 builder.append(path);
107 builder.append(", absolute=");
108 builder.append(absolute);
110 return builder.toString();