X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-jmx-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyangjmxgenerator%2Fattribute%2FDependencyAttribute.java;h=b2aa4a799ac9b85c857744336fa1bd524e94eaf8;hp=1912b75e0ee740c31634c2e709650a7d0c33728a;hb=db89afdefb3cfa4454dfdc6008e1d54d3ede66fb;hpb=bab3649670c33b3b12a49c59fc1c5cabcbcb924e diff --git a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/DependencyAttribute.java b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/DependencyAttribute.java index 1912b75e0e..b2aa4a799a 100644 --- a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/DependencyAttribute.java +++ b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/DependencyAttribute.java @@ -7,27 +7,20 @@ */ package org.opendaylight.controller.config.yangjmxgenerator.attribute; -import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry; -import org.opendaylight.yangtools.binding.generator.util.Types; -import org.opendaylight.yangtools.sal.binding.model.api.Type; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; - import javax.management.ObjectName; import javax.management.openmbean.SimpleType; +import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry; +import org.opendaylight.mdsal.binding.generator.util.Types; +import org.opendaylight.mdsal.binding.model.api.Type; +import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -public class DependencyAttribute extends AbstractAttribute implements - TypedAttribute { +public class DependencyAttribute extends AbstractDependencyAttribute { - private final Dependency dependency; - private final String nullableDescription, nullableDefault; - public DependencyAttribute(DataSchemaNode attrNode, - ServiceInterfaceEntry sie, boolean mandatory, - String nullableDescription) { - super(attrNode); - dependency = new Dependency(sie, mandatory); - this.nullableDescription = nullableDescription; - nullableDefault = null; + public DependencyAttribute(final DataSchemaNode attrNode, + final ServiceInterfaceEntry sie, final boolean mandatory, + final String nullableDescription) { + super(attrNode, sie, mandatory, nullableDescription); } @Override @@ -35,109 +28,9 @@ public class DependencyAttribute extends AbstractAttribute implements return Types.typeForClass(ObjectName.class); } - public Dependency getDependency() { - return dependency; - } - - @Override - public String getNullableDescription() { - return nullableDescription; - } - - @Override - public String getNullableDefault() { - return nullableDefault; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - if (!super.equals(o)) - return false; - - DependencyAttribute that = (DependencyAttribute) o; - - if (dependency != null ? !dependency.equals(that.dependency) - : that.dependency != null) - return false; - if (nullableDefault != null ? !nullableDefault - .equals(that.nullableDefault) : that.nullableDefault != null) - return false; - if (nullableDescription != null ? !nullableDescription - .equals(that.nullableDescription) - : that.nullableDescription != null) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (dependency != null ? dependency.hashCode() : 0); - result = 31 - * result - + (nullableDescription != null ? nullableDescription.hashCode() - : 0); - result = 31 * result - + (nullableDefault != null ? nullableDefault.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "DependencyAttribute{" + getAttributeYangName() + "," - + "dependency=" + dependency + '}'; - } - @Override public SimpleType getOpenType() { return SimpleType.OBJECTNAME; } - public static class Dependency { - private final ServiceInterfaceEntry sie; - private final boolean mandatory; - - public Dependency(ServiceInterfaceEntry sie, boolean mandatory) { - this.sie = sie; - this.mandatory = mandatory; - } - - public ServiceInterfaceEntry getSie() { - return sie; - } - - public boolean isMandatory() { - return mandatory; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - Dependency that = (Dependency) o; - - if (mandatory != that.mandatory) - return false; - if (!sie.equals(that.sie)) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = sie.hashCode(); - result = 31 * result + (mandatory ? 1 : 0); - return result; - } - } - }