- URI namespace = first.getNamespace();
- Date revision = first.getRevision();
- Module parentModule = schemaContext.findModuleByNamespaceAndRevision(namespace, revision);
- String basePackageName = BindingMapping.getRootPackageName(parentModule.getQNameModule());
-
- // Backwards compatibility: Union types used to be instantiated in YANG namespace, which is no longer
- // the case, as unions are emitted to their correct schema path. Create a proxy instance to meet the
- // codepath's expectations
- final SchemaPath typePath;
- if (type instanceof UnionType) {
- typePath = type.getPath();
- } else {
- typePath = UnionType.create(((UnionTypeDefinition)type).getTypes()).getPath();
- }
-
- String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, typePath);
+ final URI namespace = first.getNamespace();
+ final Date revision = first.getRevision();
+ final Module parentModule = this.schemaContext.findModuleByNamespaceAndRevision(namespace, revision);
+ final String basePackageName = BindingMapping.getRootPackageName(parentModule.getQNameModule());
+ final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, UNION_PATH);