Bug 4933: Yang parser does not accept deviate "not-supported"
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / StatementIdentifier.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.stmt.reactor;
9
10 import com.google.common.base.Preconditions;
11 import java.util.Objects;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.QName;
15
16 class StatementIdentifier {
17
18     private final QName name;
19     private final String argument;
20
21     StatementIdentifier(@Nonnull final QName name, @Nullable final String argument) {
22         this.name = Preconditions.checkNotNull(name);
23         this.argument = argument;
24     }
25
26     @Nonnull QName getName() {
27         return name;
28     }
29
30     @Nullable String getArgument() {
31         return argument;
32     }
33
34     @Override
35     public int hashCode() {
36         final int prime = 31;
37         int result = 1;
38         result = prime * result + name.hashCode();
39         result = prime * result + Objects.hashCode(argument);
40         return result;
41     }
42
43     @Override
44     public boolean equals(final Object obj) {
45         if (this == obj) {
46             return true;
47         }
48         if (obj == null) {
49             return false;
50         }
51         if (getClass() != obj.getClass()) {
52             return false;
53         }
54         StatementIdentifier other = (StatementIdentifier) obj;
55         if (!name.equals(other.name)) {
56             return false;
57         }
58         return Objects.equals(argument, other.argument);
59     }
60
61     @Override
62     public String toString() {
63         return "StatementIdentifier [name=" + name + ", argument=" + argument + "]";
64     }
65 }