BaseYangTypesProvider implements TypeProvider { @Override public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode, final boolean lenientRelativeLeafrefs) { return type == null ? null : BaseYangTypes.javaTypeForYangType(type.getQName().getLocalName()); } private  BaseYangTypesProvider(); @Override Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
            final boolean lenientRelativeLeafrefs); @Override Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
            final Restrictions restrictions, final boolean lenientRelativeLeafrefs); @Override String getTypeDefaultConstruction(final LeafSchemaNode node); @Override String getConstructorPropertyName(final SchemaNode node); @Override String getParamNameFromType(final TypeDefinition<?> type); static final @NonNull BaseYangTypesProvider INSTANCE; }
@Test public void javaTypeForSchemaDefinitionTypeTest() { final TypeProvider typeProvider = BaseYangTypesProvider.INSTANCE; Type javaType = typeProvider.javaTypeForSchemaDefinitionType(binary, binary); assertNotNull(javaType); assertEquals("byte[]", javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(decimal64, decimal64); assertNotNull(javaType); assertEquals(BigDecimal.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(enumeration, enumeration); assertNotNull(javaType); assertEquals(Enum.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int8, int8); assertNotNull(javaType); assertEquals(Byte.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int16, int16); assertNotNull(javaType); assertEquals(Short.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int32, int32); assertNotNull(javaType); assertEquals(Integer.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int64, int64); assertNotNull(javaType); assertEquals(Long.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(string, string); assertNotNull(javaType); assertEquals(String.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint8, uint8); assertNotNull(javaType); assertEquals(Uint8.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint16, uint16); assertNotNull(javaType); assertEquals(Uint16.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint32, uint32); assertNotNull(javaType); assertEquals(Uint32.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint64, uint64); assertNotNull(javaType); assertEquals(Uint64.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(empty, empty); assertNotNull(javaType); assertEquals(Empty.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(bool, bool); assertNotNull(javaType); assertEquals(Boolean.class.getCanonicalName(), javaType.getFullyQualifiedName()); }
@Test public void javaTypeForRestrictedSchemaDefinitionTypeTest() { final TypeProvider typeProvider = BaseYangTypesProvider.INSTANCE; Type javaType = typeProvider.javaTypeForSchemaDefinitionType(binary, binary, BindingGeneratorUtil.getRestrictions(binary)); assertNotNull(javaType); assertEquals("byte[]", javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(decimal64, decimal64, BindingGeneratorUtil.getRestrictions(decimal64)); assertNotNull(javaType); assertEquals(BigDecimal.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(enumeration, enumeration, BindingGeneratorUtil.getRestrictions(enumeration)); assertNotNull(javaType); assertEquals(Enum.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int8, int8, BindingGeneratorUtil.getRestrictions(int8)); assertNotNull(javaType); assertEquals(Byte.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int16, int16, BindingGeneratorUtil.getRestrictions(int16)); assertNotNull(javaType); assertEquals(Short.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int32, int32, BindingGeneratorUtil.getRestrictions(int32)); assertNotNull(javaType); assertEquals(Integer.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(int64, int64, BindingGeneratorUtil.getRestrictions(int64)); assertNotNull(javaType); assertEquals(Long.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(string, string, BindingGeneratorUtil.getRestrictions(string)); assertNotNull(javaType); assertEquals(String.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint8, uint8, BindingGeneratorUtil.getRestrictions(uint8)); assertNotNull(javaType); assertEquals(Uint8.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint16, uint16, BindingGeneratorUtil.getRestrictions(uint16)); assertNotNull(javaType); assertEquals(Uint16.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint32, uint32, BindingGeneratorUtil.getRestrictions(uint32)); assertNotNull(javaType); assertEquals(Uint32.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(uint64, uint64, BindingGeneratorUtil.getRestrictions(uint64)); assertNotNull(javaType); assertEquals(Uint64.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(empty, empty, BindingGeneratorUtil.getRestrictions(empty)); assertNotNull(javaType); assertEquals(Empty.class.getCanonicalName(), javaType.getFullyQualifiedName()); javaType = typeProvider.javaTypeForSchemaDefinitionType(bool, bool, BindingGeneratorUtil.getRestrictions(bool)); assertNotNull(javaType); assertEquals(Boolean.class.getCanonicalName(), javaType.getFullyQualifiedName()); }