X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Fmapping%2Fattributes%2FAttributeIfcSwitchStatement.java;h=697b811d51c90c9b7cab4f05f266292d25d2a260;hp=4b6dcfd46528b3068fe2a7c41dc9b9224f205b9c;hb=43b37a609662f705d2dd701cb8b7c479144d2ef1;hpb=4f4df9918bc2d1447393edac6fbf3a2d4f9d9186 diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java index 4b6dcfd465..697b811d51 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java @@ -12,7 +12,9 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIf import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute; import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute; import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListAttribute; +import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute; import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute; +import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition; import javax.management.openmbean.ArrayType; import javax.management.openmbean.CompositeType; @@ -29,7 +31,10 @@ public abstract class AttributeIfcSwitchStatement { if (attributeIfc instanceof JavaAttribute) { try { - return caseJavaAttribute(attributeIfc.getOpenType()); + if(((JavaAttribute)attributeIfc).getTypeDefinition() instanceof BinaryTypeDefinition) { + return caseJavaBinaryAttribute(attributeIfc.getOpenType()); + } else + return caseJavaAttribute(attributeIfc.getOpenType()); } catch (UnknownOpenTypeException e) { throw getIllegalArgumentException(attributeIfc); } @@ -37,7 +42,9 @@ public abstract class AttributeIfcSwitchStatement { } else if (attributeIfc instanceof DependencyAttribute) { return caseDependencyAttribute(((DependencyAttribute) attributeIfc).getOpenType()); } else if (attributeIfc instanceof ListAttribute) { - return caseListAttribute(((ListAttribute) attributeIfc).getOpenType()); + return caseListAttribute((ArrayType) attributeIfc.getOpenType()); + } else if (attributeIfc instanceof ListDependenciesAttribute) { + return caseListDependeciesAttribute((ArrayType) attributeIfc.getOpenType()); } else if (attributeIfc instanceof TOAttribute) { return caseTOAttribute(((TOAttribute) attributeIfc).getOpenType()); } @@ -45,6 +52,10 @@ public abstract class AttributeIfcSwitchStatement { throw getIllegalArgumentException(attributeIfc); } + protected T caseJavaBinaryAttribute(OpenType openType) { + return caseJavaAttribute(openType); + } + private IllegalArgumentException getIllegalArgumentException(AttributeIfc attributeIfc) { return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc + " with open type:" + attributeIfc.getOpenType()); @@ -74,6 +85,7 @@ public abstract class AttributeIfcSwitchStatement { protected abstract T caseListAttribute(ArrayType openType); + protected abstract T caseListDependeciesAttribute(ArrayType openType); private static class UnknownOpenTypeException extends RuntimeException { public UnknownOpenTypeException(String message) {