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%2FTOAttribute.java;h=2fa4379f031f7e3e29c46bdeb6944d8a8d13f471;hp=5b7385800ef417674338d76ce708c6a09e50e6bf;hb=20a32e6459fd1e27e7669bf1ebc7742b96787b94;hpb=b95285098ab2090d36095c69fc838d4df4d61300 diff --git a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TOAttribute.java b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TOAttribute.java index 5b7385800e..2fa4379f03 100644 --- a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TOAttribute.java +++ b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TOAttribute.java @@ -52,19 +52,16 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute { // Transfer Object: get the leaves final Map map = new HashMap<>(); final Map attributeNameMap = new HashMap<>(); - for (final DataSchemaNode dataSchemaNode : containerSchemaNode - .getChildNodes()) { + for (final DataSchemaNode dataSchemaNode : containerSchemaNode.getChildNodes()) { try { final String yangName = dataSchemaNode.getQName().getLocalName(); - map.put(yangName, - createInnerAttribute(dataSchemaNode, - typeProviderWrapper, packageName)); + map.put(yangName, createInnerAttribute(dataSchemaNode, typeProviderWrapper, packageName)); } catch (final IllegalArgumentException e) { throw new IllegalStateException("Unable to create TO", e); } } return new TOAttribute(containerSchemaNode, map, attributeNameMap, - containerSchemaNode.getDescription(), packageName); + containerSchemaNode.getDescription().orElse(null), packageName); } private static AttributeIfc createInnerAttribute( @@ -73,17 +70,13 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute { final Class type = isAllowedType(dataSchemaNode); if (type.equals(LeafSchemaNode.class)) { - return new JavaAttribute((LeafSchemaNode) dataSchemaNode, - typeProviderWrapper); + return new JavaAttribute((LeafSchemaNode) dataSchemaNode, typeProviderWrapper); } else if (type.equals(ListSchemaNode.class)) { - return ListAttribute.create((ListSchemaNode) dataSchemaNode, - typeProviderWrapper, packageName); + return ListAttribute.create((ListSchemaNode) dataSchemaNode, typeProviderWrapper, packageName); } else if (type.equals(LeafListSchemaNode.class)) { - return ListAttribute.create((LeafListSchemaNode) dataSchemaNode, - typeProviderWrapper); + return ListAttribute.create((LeafListSchemaNode) dataSchemaNode, typeProviderWrapper); } else if (type.equals(ContainerSchemaNode.class)) { - return TOAttribute.create((ContainerSchemaNode) dataSchemaNode, - typeProviderWrapper, packageName); + return TOAttribute.create((ContainerSchemaNode) dataSchemaNode, typeProviderWrapper, packageName); } throw new IllegalStateException("This should never happen"); @@ -92,7 +85,7 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute { private static Class isAllowedType( final DataSchemaNode dataSchemaNode) { for (final Class allowedType : ALLOWED_CHILDREN) { - if (allowedType.isAssignableFrom(dataSchemaNode.getClass()) == true) { + if (allowedType.isAssignableFrom(dataSchemaNode.getClass())) { return allowedType; } } @@ -160,7 +153,7 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute { if (this == o) { return true; } - if ((o == null) || (getClass() != o.getClass())) { + if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { @@ -190,14 +183,14 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute { @Override public int hashCode() { int result = super.hashCode(); - result = (31 - * result) + result = 31 + * result + (this.nullableDescription != null ? this.nullableDescription.hashCode() : 0); - result = (31 * result) + result = 31 * result + (this.nullableDefault != null ? this.nullableDefault.hashCode() : 0); - result = (31 - * result) + result = 31 + * result + (this.yangNameToAttributeMap != null ? this.yangNameToAttributeMap .hashCode() : 0); return result;