Refactored base yang-java types.
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / YangTypesConverter.java
index f7ea048a0780003c444c1516a8f3a8dae802f0ed..7b75a30247bd72af8773b71bfe7018cd74d11dc1 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.yangtools.yang.model.util;
 import java.util.HashSet;\r
 import java.util.Set;\r
 \r
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;\r
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;\r
 \r
 public final class YangTypesConverter {\r
@@ -42,39 +41,40 @@ public final class YangTypesConverter {
         return baseYangTypes.contains(type);\r
     }\r
 \r
-    public static TypeDefinition<?> javaTypeForBaseYangType(SchemaPath path, String typeName) {\r
+    public static TypeDefinition<?> javaTypeForBaseYangType(String typeName) {\r
         TypeDefinition<?> type = null;\r
 \r
         if (typeName.startsWith("int")) {\r
             if ("int8".equals(typeName)) {\r
-                type = new Int8(path);\r
+                type = Int8.getInstance();\r
             } else if ("int16".equals(typeName)) {\r
-                type = new Int16(path);\r
+                type = Int16.getInstance();\r
             } else if ("int32".equals(typeName)) {\r
-                type = new Int32(path);\r
+                type = Int32.getInstance();\r
             } else if ("int64".equals(typeName)) {\r
-                type = new Int64(path);\r
+                type = Int64.getInstance();\r
             }\r
         } else if (typeName.startsWith("uint")) {\r
             if ("uint8".equals(typeName)) {\r
-                type = new Uint8(path);\r
+                type = Uint8.getInstance();\r
             } else if ("uint16".equals(typeName)) {\r
-                type = new Uint16(path);\r
+                type = Uint16.getInstance();\r
             } else if ("uint32".equals(typeName)) {\r
-                type = new Uint32(path);\r
+                type = Uint32.getInstance();\r
             } else if ("uint64".equals(typeName)) {\r
-                type = new Uint64(path);\r
+                type = Uint64.getInstance();\r
             }\r
         } else if ("string".equals(typeName)) {\r
-            type = new StringType(path);\r
+            type = StringType.getIntance();\r
         } else if("binary".equals(typeName)) {\r
-            type = new BinaryType(path);\r
+            type = BinaryType.getInstance();\r
         } else if("boolean".equals(typeName)) {\r
-            type = new BooleanType(path);\r
+            type = BooleanType.getInstance();\r
         } else if("empty".equals(typeName)) {\r
-            type = new EmptyType(path);\r
+            type = EmptyType.getInstance();\r
         } else if("instance-identifier".equals(typeName)) {\r
-            type = new InstanceIdentifier(path, null, true);\r
+            // FIXME\r
+            type = new InstanceIdentifier(null, true);\r
         }\r
 \r
         return type;\r