2 * Copyright (c) 2015 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.parser.stmt.rfc6020.effective;
10 import java.util.Objects;
11 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
12 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
13 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 public class MustEffectiveStatementImpl extends EffectiveStatementBase<RevisionAwareXPath, MustStatement> implements
19 private final RevisionAwareXPath xPath;
20 private final String description;
21 private final String errorAppTag;
22 private final String errorMessage;
23 private final String reference;
25 public MustEffectiveStatementImpl(final StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
27 this.xPath = ctx.getStatementArgument();
29 DescriptionEffectiveStatementImpl descriptionStmt = firstEffective(DescriptionEffectiveStatementImpl.class);
30 this.description = (descriptionStmt == null) ? null : descriptionStmt.argument();
32 ErrorAppTagEffectiveStatementImpl errorAppTagStmt = firstEffective(ErrorAppTagEffectiveStatementImpl.class);
33 this.errorAppTag = (errorAppTagStmt == null) ? null : errorAppTagStmt.argument();
35 ErrorMessageEffectiveStatementImpl errorMessageStmt = firstEffective(ErrorMessageEffectiveStatementImpl.class);
36 this.errorMessage = (errorMessageStmt == null) ? null : errorMessageStmt.argument();
38 ReferenceEffectiveStatementImpl referenceStmt = firstEffective(ReferenceEffectiveStatementImpl.class);
39 this.reference = (referenceStmt == null) ? null : referenceStmt.argument();
43 public RevisionAwareXPath getXpath() {
48 public String getDescription() {
53 public String getErrorAppTag() {
58 public String getErrorMessage() {
63 public String getReference() {
68 public int hashCode() {
71 result = prime * result + Objects.hashCode(xPath);
72 result = prime * result + Objects.hashCode(description);
73 result = prime * result + Objects.hashCode(reference);
78 public boolean equals(final Object obj) {
85 if (getClass() != obj.getClass()) {
88 final MustEffectiveStatementImpl other = (MustEffectiveStatementImpl) obj;
89 if (!Objects.equals(xPath, other.xPath)) {
92 if (!Objects.equals(description, other.description)) {
95 if (!Objects.equals(reference, other.reference)) {
102 public String toString() {
103 return xPath.toString();