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;
this.lastAttribute = attributeIfc;
+ OpenType<?> openType = attributeIfc.getOpenType();
+
if (attributeIfc instanceof JavaAttribute) {
try {
- return caseJavaAttribute(attributeIfc.getOpenType());
+ if(((JavaAttribute)attributeIfc).getTypeDefinition() instanceof BinaryTypeDefinition) {
+ return caseJavaBinaryAttribute(openType);
+ } else if(((JavaAttribute)attributeIfc).isUnion()) {
+ return caseJavaUnionAttribute(openType);
+ } else if(((JavaAttribute)attributeIfc).isIdentityRef()) {
+ return caseJavaIdentityRefAttribute(openType);
+ } else
+ return caseJavaAttribute(openType);
} catch (UnknownOpenTypeException e) {
throw getIllegalArgumentException(attributeIfc);
}
} else if (attributeIfc instanceof DependencyAttribute) {
return caseDependencyAttribute(((DependencyAttribute) attributeIfc).getOpenType());
} else if (attributeIfc instanceof ListAttribute) {
- return caseListAttribute((ArrayType<?>) attributeIfc.getOpenType());
+ return caseListAttribute((ArrayType<?>) openType);
} else if (attributeIfc instanceof ListDependenciesAttribute) {
- return caseListDependeciesAttribute((ArrayType<?>) attributeIfc.getOpenType());
+ return caseListDependeciesAttribute((ArrayType<?>) openType);
} else if (attributeIfc instanceof TOAttribute) {
return caseTOAttribute(((TOAttribute) attributeIfc).getOpenType());
}
throw getIllegalArgumentException(attributeIfc);
}
+ protected T caseJavaIdentityRefAttribute(OpenType<?> openType) {
+ return caseJavaAttribute(openType);
+ }
+
+ protected T caseJavaUnionAttribute(OpenType<?> openType) {
+ return caseJavaAttribute(openType);
+ }
+
+ protected T caseJavaBinaryAttribute(OpenType<?> openType) {
+ return caseJavaAttribute(openType);
+ }
private IllegalArgumentException getIllegalArgumentException(AttributeIfc attributeIfc) {
return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc