@Test public void testgetJavaClassInfo() { test = getJavaImportClass(getStubYangType(TYPE1), false, pluginConfig); assertThat(true, is(test.equals(CLASS_INFO1))); test = getJavaImportClass(getStubYangType(TYPE2), true, pluginConfig); assertThat(true, is(test.equals(CLASS_INFO5))); test = getJavaImportClass(getStubYangType(TYPE3), false, pluginConfig); assertThat(null, is(test)); test = getJavaImportClass(getStubYangType(TYPE4), false, pluginConfig); assertThat(null, is(test)); }
public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr, YangToJavaNamingConflictUtil pluginConfig) { YangDataTypes type = yangType.getDataType(); if (isListAttr) { switch (type) { case INT8: return BYTE_WRAPPER; case INT16: return SHORT_WRAPPER; case INT32: return INTEGER_WRAPPER; case INT64: return LONG_WRAPPER; case UINT8: return SHORT_WRAPPER; case UINT16: return INTEGER_WRAPPER; case UINT32: return LONG_WRAPPER; case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case BOOLEAN: return BOOLEAN_WRAPPER; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_WRAPPER; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: throw new TranslatorException("given data type is not supported."); } } else { switch (type) { case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_DATA_TYPE; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: return null; } } return null; }
AttributesJavaDataType { public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr, YangToJavaNamingConflictUtil pluginConfig) { YangDataTypes type = yangType.getDataType(); if (isListAttr) { switch (type) { case INT8: return BYTE_WRAPPER; case INT16: return SHORT_WRAPPER; case INT32: return INTEGER_WRAPPER; case INT64: return LONG_WRAPPER; case UINT8: return SHORT_WRAPPER; case UINT16: return INTEGER_WRAPPER; case UINT32: return LONG_WRAPPER; case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case BOOLEAN: return BOOLEAN_WRAPPER; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_WRAPPER; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: throw new TranslatorException("given data type is not supported."); } } else { switch (type) { case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_DATA_TYPE; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: return null; } } return null; } }
AttributesJavaDataType { public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr, YangToJavaNamingConflictUtil pluginConfig) { YangDataTypes type = yangType.getDataType(); if (isListAttr) { switch (type) { case INT8: return BYTE_WRAPPER; case INT16: return SHORT_WRAPPER; case INT32: return INTEGER_WRAPPER; case INT64: return LONG_WRAPPER; case UINT8: return SHORT_WRAPPER; case UINT16: return INTEGER_WRAPPER; case UINT32: return LONG_WRAPPER; case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case BOOLEAN: return BOOLEAN_WRAPPER; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_WRAPPER; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: throw new TranslatorException("given data type is not supported."); } } else { switch (type) { case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_DATA_TYPE; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: return null; } } return null; } private  AttributesJavaDataType(); }
AttributesJavaDataType { public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr, YangToJavaNamingConflictUtil pluginConfig) { YangDataTypes type = yangType.getDataType(); if (isListAttr) { switch (type) { case INT8: return BYTE_WRAPPER; case INT16: return SHORT_WRAPPER; case INT32: return INTEGER_WRAPPER; case INT64: return LONG_WRAPPER; case UINT8: return SHORT_WRAPPER; case UINT16: return INTEGER_WRAPPER; case UINT32: return LONG_WRAPPER; case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case BOOLEAN: return BOOLEAN_WRAPPER; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_WRAPPER; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: throw new TranslatorException("given data type is not supported."); } } else { switch (type) { case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_DATA_TYPE; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: return null; } } return null; } private  AttributesJavaDataType(); static String getJavaDataType(YangType<?> yangType); static String getJavaImportClass(YangType<?> yangType, boolean isListAttr,
                                            YangToJavaNamingConflictUtil pluginConfig); static String getJavaImportPackage(YangType<?> yangType, boolean isListAttr,
                                              YangToJavaNamingConflictUtil conflictResolver); static void updateJavaFileInfo(YangNode yangNode,
                                          YangToJavaNamingConflictUtil conflictResolver); }
AttributesJavaDataType { public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr, YangToJavaNamingConflictUtil pluginConfig) { YangDataTypes type = yangType.getDataType(); if (isListAttr) { switch (type) { case INT8: return BYTE_WRAPPER; case INT16: return SHORT_WRAPPER; case INT32: return INTEGER_WRAPPER; case INT64: return LONG_WRAPPER; case UINT8: return SHORT_WRAPPER; case UINT16: return INTEGER_WRAPPER; case UINT32: return LONG_WRAPPER; case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case BOOLEAN: return BOOLEAN_WRAPPER; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_WRAPPER; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: throw new TranslatorException("given data type is not supported."); } } else { switch (type) { case UINT64: return BIG_INTEGER; case DECIMAL64: return YANG_DECIMAL64_CLASS; case STRING: return STRING_DATA_TYPE; case ENUMERATION: return getCapitalCase( getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case BITS: return YANG_BITS_CLASS; case BINARY: return YANG_BINARY_CLASS; case LEAFREF: break; case IDENTITYREF: break; case EMPTY: return BOOLEAN_DATA_TYPE; case UNION: return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(), pluginConfig)); case INSTANCE_IDENTIFIER: break; case DERIVED: return getCapitalCase( getCamelCase(yangType.getDataTypeName(), pluginConfig)); default: return null; } } return null; } private  AttributesJavaDataType(); static String getJavaDataType(YangType<?> yangType); static String getJavaImportClass(YangType<?> yangType, boolean isListAttr,
                                            YangToJavaNamingConflictUtil pluginConfig); static String getJavaImportPackage(YangType<?> yangType, boolean isListAttr,
                                              YangToJavaNamingConflictUtil conflictResolver); static void updateJavaFileInfo(YangNode yangNode,
                                          YangToJavaNamingConflictUtil conflictResolver);  }