BaseYangTypes { public static Type javaTypeForYangType(final String type) { switch (type) { case "binary": return BINARY_TYPE; case "boolean": return BOOLEAN_TYPE; case "decimal64": return DECIMAL64_TYPE; case "empty": return EMPTY_TYPE; case "enumeration": return ENUM_TYPE; case "instance-identifier": return INSTANCE_IDENTIFIER; case "int8": return INT8_TYPE; case "int16": return INT16_TYPE; case "int32": return INT32_TYPE; case "int64": return INT64_TYPE; case "string": return STRING_TYPE; case "uint8": return UINT8_TYPE; case "uint16": return UINT16_TYPE; case "uint32": return UINT32_TYPE; case "uint64": return UINT64_TYPE; default: return null; } } private  BaseYangTypes(); static Type javaTypeForYangType(final String type); static final Type BOOLEAN_TYPE; static final Type EMPTY_TYPE; static final Type ENUM_TYPE; static final Type INT8_TYPE; static final Type INT16_TYPE; static final Type INT32_TYPE; static final Type INT64_TYPE; static final Type STRING_TYPE; static final Type DECIMAL64_TYPE; static final Type UINT8_TYPE; static final Type UINT16_TYPE; static final Type UINT32_TYPE; static final Type UINT64_TYPE; static final Type BINARY_TYPE; static final Type INSTANCE_IDENTIFIER; }
@Test public void test() { Type stringType = BaseYangTypes.javaTypeForYangType("string"); assertEquals("java.lang", stringType.getPackageName()); assertEquals("String", stringType.getName()); assertTrue(stringType instanceof ConcreteType); ParameterizedType stringBooleanMap = Types.mapTypeFor( BaseYangTypes.javaTypeForYangType("string"), BaseYangTypes.javaTypeForYangType("boolean")); assertTrue(!(stringBooleanMap instanceof ConcreteType)); assertEquals("java.util", stringBooleanMap.getPackageName()); assertEquals("Map", stringBooleanMap.getName()); assertEquals(2, stringBooleanMap.getActualTypeArguments().length); }