X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fyang-model-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fparser%2Futil%2FMustDefinitionImpl.java;fp=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fyang-model-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fparser%2Futil%2FMustDefinitionImpl.java;h=31f39e325a61984df98def4fc5263e9f110c28c7;hb=8992ae54ecd2c79e0d93d0904962c5f32f3bb33a;hp=0000000000000000000000000000000000000000;hpb=e8c736d30bc80ba229a1b6d35802e05c2ffe3a78;p=controller.git diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/MustDefinitionImpl.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/MustDefinitionImpl.java new file mode 100644 index 0000000000..31f39e325a --- /dev/null +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/MustDefinitionImpl.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.yang.parser.util; + +import org.opendaylight.controller.yang.model.api.MustDefinition; +import org.opendaylight.controller.yang.model.api.RevisionAwareXPath; + +public final class MustDefinitionImpl implements MustDefinition { + private final String mustStr; + private final String description; + private final String reference; + private final String errorAppTag; + private final String errorMessage; + + public MustDefinitionImpl(String mustStr, String description, + String reference, String errorAppTag, String errorMessage) { + this.mustStr = mustStr; + this.description = description; + this.reference = reference; + this.errorAppTag = errorAppTag; + this.errorMessage = errorMessage; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getErrorAppTag() { + return errorAppTag; + } + + @Override + public String getErrorMessage() { + return errorMessage; + } + + @Override + public String getReference() { + return reference; + } + + @Override + public RevisionAwareXPath getXpath() { + return null; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((mustStr == null) ? 0 : mustStr.hashCode()); + result = prime * result + + ((description == null) ? 0 : description.hashCode()); + result = prime * result + + ((reference == null) ? 0 : reference.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final MustDefinitionImpl other = (MustDefinitionImpl) obj; + if (mustStr == null) { + if (other.mustStr != null) { + return false; + } + } else if (!mustStr.equals(other.mustStr)) { + return false; + } + if (description == null) { + if (other.description != null) { + return false; + } + } else if (!description.equals(other.description)) { + return false; + } + if (reference == null) { + if (other.reference != null) { + return false; + } + } else if (!reference.equals(other.reference)) { + return false; + } + return true; + } + + @Override + public String toString() { + return mustStr; + } + +}