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.ArrayList;
11 import java.util.Collections;
12 import java.util.List;
14 import org.opendaylight.yangtools.yang.common.QName;
18 * Represents unique path to the every node inside the module.
21 public class SchemaPath {
24 * List of QName instances which represents complete path to the node.
26 final List<QName> path;
29 * Boolean value which represents type of schema path (relative or
32 final boolean absolute;
35 * Constructs new instance of this class with the concrete path.
38 * list of QName instances which specifies exact path to the
41 * boolean value which specifies if the path is absolute or
44 public SchemaPath(final List<QName> path, boolean absolute) {
45 this.path = Collections.unmodifiableList(new ArrayList<QName>(path));
46 this.absolute = absolute;
50 * Returns the complete path to schema node.
52 * @return list of <code>QName</code> instances which represents complete
55 public List<QName> getPath() {
60 * Describes whether schema path is|isn't absolute.
62 * @return boolean value which is <code>true</code> if schema path is
65 public boolean isAbsolute() {
70 public int hashCode() {
73 result = prime * result + (absolute ? 1231 : 1237);
74 result = prime * result + ((path == null) ? 0 : path.hashCode());
79 public boolean equals(Object obj) {
86 if (getClass() != obj.getClass()) {
89 SchemaPath other = (SchemaPath) obj;
90 if (absolute != other.absolute) {
94 if (other.path != null) {
97 } else if (!path.equals(other.path)) {
104 public String toString() {
105 StringBuilder builder = new StringBuilder();
106 builder.append("SchemaPath [path=");
107 builder.append(path);
108 builder.append(", absolute=");
109 builder.append(absolute);
111 return builder.toString();