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%2FJavaAttribute.java;h=f6ce92d5069be1adbd02050176652790def8af95;hp=5b0196cdda78d4354ab01c8cae3c156f1cfbbd64;hb=73dcd6419a9804de962edafa58fac490e6a270a7;hpb=07c30f447bd1366ba18e6f0f41ac768a16dbc901 diff --git a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java index 5b0196cdda..f6ce92d506 100644 --- a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java +++ b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java @@ -8,6 +8,13 @@ package org.opendaylight.controller.config.yangjmxgenerator.attribute; import com.google.common.base.Preconditions; +import java.util.Arrays; +import java.util.List; +import javax.management.openmbean.ArrayType; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenDataException; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; import org.opendaylight.controller.config.api.IdentityAttributeRef; import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper; import org.opendaylight.yangtools.sal.binding.model.api.Type; @@ -17,14 +24,6 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition; -import javax.management.openmbean.ArrayType; -import javax.management.openmbean.CompositeType; -import javax.management.openmbean.OpenDataException; -import javax.management.openmbean.OpenType; -import javax.management.openmbean.SimpleType; -import java.util.Arrays; -import java.util.List; - public class JavaAttribute extends AbstractAttribute implements TypedAttribute { public static final String DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION = "valueOfArtificialUnionProperty"; @@ -96,24 +95,30 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; - if (!super.equals(o)) + } + if (!super.equals(o)) { return false; + } JavaAttribute that = (JavaAttribute) o; if (nullableDefault != null ? !nullableDefault - .equals(that.nullableDefault) : that.nullableDefault != null) + .equals(that.nullableDefault) : that.nullableDefault != null) { return false; + } if (nullableDescription != null ? !nullableDescription .equals(that.nullableDescription) - : that.nullableDescription != null) + : that.nullableDescription != null) { return false; - if (type != null ? !type.equals(that.type) : that.type != null) + } + if (type != null ? !type.equals(that.type) : that.type != null) { return false; + } return true; } @@ -185,7 +190,9 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute { OpenType innerCompositeType; if(isDerivedType(innerTypeBaseType, innerType)) { - innerCompositeType = getCompositeType(innerTypeBaseType, baseInnerTypeDefinition); + innerCompositeType = baseInnerTypeDefinition instanceof UnionTypeDefinition ? + getCompositeTypeForUnion(baseInnerTypeDefinition) : + getCompositeType(innerTypeBaseType, baseInnerTypeDefinition); } else { innerCompositeType = SimpleTypeResolver.getSimpleType(innerType); } @@ -225,7 +232,7 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute { return simpleType; } - private OpenType getCompositeType(Type baseType, TypeDefinition baseTypeDefinition) { + private OpenType getCompositeType(Type baseType, TypeDefinition baseTypeDefinition) { SimpleType innerItemType = SimpleTypeResolver.getSimpleType(baseType); String innerItemName = typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition); @@ -274,8 +281,9 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute { // TODO verify private boolean isPrimitive(String innerTypeFullyQName) { - if (innerTypeFullyQName.contains(".")) + if (innerTypeFullyQName.contains(".")) { return false; + } return true; }