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.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
17 public class MustEffectiveStatementImpl extends EffectiveStatementBase<RevisionAwareXPath, MustStatement> implements
20 private final RevisionAwareXPath xPath;
21 private String description;
22 private String errorAppTag;
23 private String errorMessage;
24 private String reference;
26 public MustEffectiveStatementImpl(final StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
31 xPath = ctx.getStatementArgument();
34 private void initFields() {
36 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
38 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
39 description = ((DescriptionEffectiveStatementImpl) effectiveStatement).argument();
41 if (effectiveStatement instanceof ErrorAppTagEffectiveStatementImpl) {
42 errorAppTag = ((ErrorAppTagEffectiveStatementImpl) effectiveStatement).argument();
44 if (effectiveStatement instanceof ErrorMessageEffectiveStatementImpl) {
45 errorMessage = ((ErrorMessageEffectiveStatementImpl) effectiveStatement).argument();
47 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
48 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement).argument();
54 public RevisionAwareXPath getXpath() {
59 public String getDescription() {
64 public String getErrorAppTag() {
69 public String getErrorMessage() {
74 public String getReference() {
79 public int hashCode() {
82 result = prime * result + Objects.hashCode(xPath);
83 result = prime * result + Objects.hashCode(description);
84 result = prime * result + Objects.hashCode(reference);
89 public boolean equals(final Object obj) {
96 if (getClass() != obj.getClass()) {
99 final MustEffectiveStatementImpl other = (MustEffectiveStatementImpl) obj;
100 if (!Objects.equals(xPath, other.xPath)) {
103 if (!Objects.equals(description, other.description)) {
106 if (!Objects.equals(reference,other.reference)) {
113 public String toString() {
114 return xPath.toString();