import javax.management.openmbean.OpenDataException;
import javax.management.openmbean.OpenType;
import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.mdsal.binding.generator.util.ReferencedTypeImpl;
+import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.util.ReferencedTypeImpl;
import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
// Transfer Object: get the leaves
final Map<String, AttributeIfc> map = new HashMap<>();
final Map<String, String> 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(
final Class<? extends DataSchemaNode> 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");
private static Class<? extends DataSchemaNode> isAllowedType(
final DataSchemaNode dataSchemaNode) {
for (final Class<? extends DataSchemaNode> allowedType : ALLOWED_CHILDREN) {
- if (allowedType.isAssignableFrom(dataSchemaNode.getClass()) == true) {
+ if (allowedType.isAssignableFrom(dataSchemaNode.getClass())) {
return allowedType;
}
}
if (this == o) {
return true;
}
- if ((o == null) || (getClass() != o.getClass())) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
@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;
@Override
public Type getType() {
// TODO: ReferencedTypeImpl from Types
- return new ReferencedTypeImpl(this.packageName, getUpperCaseCammelCase());
+ return new ReferencedTypeImpl(JavaTypeName.create(this.packageName, getUpperCaseCammelCase()));
}
@Override