X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FYangTypesConverter.java;h=76d53d5b38b872bd2558be82f340e37b4717ea01;hp=82849891f9b42b64c9043237598986b007d78403;hb=970fb91c60c15a9b57e078f81aab7dde903addb9;hpb=d04b927ef78082525c3b0738126b6eb12e4a7a74 diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java index 82849891f9..76d53d5b38 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java @@ -52,25 +52,25 @@ public final class YangTypesConverter { String typeName) { TypeDefinition type = null; - SchemaPath path = createSchemaPath(actualPath, namespace, revision); + SchemaPath path = createSchemaPath(actualPath, namespace, revision, typeName); if (typeName.startsWith("int")) { - if (typeName.equals("int8")) { + if ("int8".equals(typeName)) { type = new Int8(path); - } else if (typeName.equals("int16")) { + } else if ("int16".equals(typeName)) { type = new Int16(path); - } else if (typeName.equals("int32")) { + } else if ("int32".equals(typeName)) { type = new Int32(path); - } else if (typeName.equals("int64")) { + } else if ("int64".equals(typeName)) { type = new Int64(path); } } else if (typeName.startsWith("uint")) { - if (typeName.equals("uint8")) { + if ("uint8".equals(typeName)) { type = new Uint8(path); - } else if (typeName.equals("uint16")) { + } else if ("uint16".equals(typeName)) { type = new Uint16(path); - } else if (typeName.equals("uint32")) { + } else if ("uint32".equals(typeName)) { type = new Uint32(path); - } else if (typeName.equals("uint64")) { + } else if ("uint64".equals(typeName)) { type = new Uint64(path); } } else if ("string".equals(typeName)) { @@ -88,11 +88,18 @@ public final class YangTypesConverter { return type; } - private static SchemaPath createSchemaPath(List actualPath, URI namespace, Date revision) { + private static SchemaPath createSchemaPath(List actualPath, URI namespace, Date revision, String typeName) { + List correctPath = new ArrayList(actualPath); + // remove module name + correctPath.remove(0); + List path = new ArrayList(); - for(String element : actualPath) { + for(String element : correctPath) { path.add(new QName(namespace, revision, element)); } + // add type qname + QName typeQName = new QName(BaseTypes.BaseTypesNamespace, typeName); + path.add(typeQName); return new SchemaPath(path, true); }