X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=code-generator%2Fbinding-generator-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fsal%2Fbinding%2Fyang%2Ftypes%2FTypeProviderImpl.java;h=1b9abbc6520ac0341831258151f2a7007ab42627;hb=8457cb6ef2f2eeb59836cbfd561c8d0d7399229a;hp=e7f81b2af55d0b8ae33befc21104564d8495e93f;hpb=0583cd60749eea6a84ca4afb8fbc1edd04a57f93;p=yangtools.git diff --git a/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java b/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java index e7f81b2af5..1b9abbc652 100644 --- a/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java +++ b/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java @@ -41,12 +41,12 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath; import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.model.api.SchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit; import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition; -import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair; import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint; @@ -78,7 +78,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Creates new instance of class TypeProviderImpl. - * + * * @param schemaContext * contains the schema data red from YANG files * @throws IllegalArgumentException @@ -95,7 +95,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Puts refType to map with key refTypePath - * + * * @param refTypePath * schema path used as the map key * @param refType @@ -105,7 +105,7 @@ public final class TypeProviderImpl implements TypeProvider { *
  • if refTypePath equal null
  • *
  • if refType equal null
  • * - * + * */ public void putReferencedType(final SchemaPath refTypePath, final Type refType) { Preconditions.checkArgument(refTypePath != null, @@ -116,9 +116,9 @@ public final class TypeProviderImpl implements TypeProvider { } /** - * + * * Converts basic YANG type type to JAVA Type. - * + * * @param type * string with YANG name of type * @returns JAVA Type for YANG type type @@ -133,7 +133,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts schema definition type typeDefinition to JAVA * Type - * + * * @param typeDefinition * type definition which is converted to JAVA type * @throws IllegalArgumentException @@ -144,7 +144,7 @@ public final class TypeProviderImpl implements TypeProvider { * */ @Override - public Type javaTypeForSchemaDefinitionType(final TypeDefinition typeDefinition) { + public Type javaTypeForSchemaDefinitionType(final TypeDefinition typeDefinition, final SchemaNode parentNode) { Type returnType = null; Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!"); if (typeDefinition.getQName() == null) { @@ -157,9 +157,9 @@ public final class TypeProviderImpl implements TypeProvider { if (typeDefinition instanceof ExtendedType) { returnType = javaTypeForExtendedType(typeDefinition); } else { - returnType = javaTypeForLeafrefOrIdentityRef(typeDefinition); + returnType = javaTypeForLeafrefOrIdentityRef(typeDefinition, parentNode); if (returnType == null) { - returnType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(typeDefinition); + returnType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(typeDefinition, parentNode); } } // TODO: add throw exception when we will be able to resolve ALL yang @@ -175,15 +175,15 @@ public final class TypeProviderImpl implements TypeProvider { * Returns JAVA Type for instances of the type * LeafrefTypeDefinition or * IdentityrefTypeDefinition. - * + * * @param typeDefinition * type definition which is converted to JAVA Type * @return JAVA Type instance for typeDefinition */ - private Type javaTypeForLeafrefOrIdentityRef(TypeDefinition typeDefinition) { + private Type javaTypeForLeafrefOrIdentityRef(TypeDefinition typeDefinition, SchemaNode parentNode) { if (typeDefinition instanceof LeafrefTypeDefinition) { final LeafrefTypeDefinition leafref = (LeafrefTypeDefinition) typeDefinition; - return provideTypeForLeafref(leafref); + return provideTypeForLeafref(leafref, parentNode); } else if (typeDefinition instanceof IdentityrefTypeDefinition) { final IdentityrefTypeDefinition idref = (IdentityrefTypeDefinition) typeDefinition; return provideTypeForIdentityref(idref); @@ -195,7 +195,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Returns JAVA Type for instances of the type * ExtendedType. - * + * * @param typeDefinition * type definition which is converted to JAVA Type * @return JAVA Type instance for typeDefinition @@ -204,13 +204,13 @@ public final class TypeProviderImpl implements TypeProvider { final String typedefName = typeDefinition.getQName().getLocalName(); final TypeDefinition baseTypeDef = baseTypeDefForExtendedType(typeDefinition); Type returnType = null; - returnType = javaTypeForLeafrefOrIdentityRef(baseTypeDef); + returnType = javaTypeForLeafrefOrIdentityRef(baseTypeDef, typeDefinition); if (returnType == null) { if (baseTypeDef instanceof EnumTypeDefinition) { final EnumTypeDefinition enumTypeDef = (EnumTypeDefinition) baseTypeDef; - returnType = provideTypeForEnum(enumTypeDef, typedefName); + returnType = provideTypeForEnum(enumTypeDef, typedefName, typeDefinition); } else { - final Module module = findParentModuleForTypeDefinition(schemaContext, typeDefinition); + final Module module = findParentModule(schemaContext, typeDefinition); if (module != null) { final Map genTOs = genTypeDefsContextMap.get(module.getName()); if (genTOs != null) { @@ -218,7 +218,7 @@ public final class TypeProviderImpl implements TypeProvider { } if (returnType == null) { returnType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER - .javaTypeForSchemaDefinitionType(baseTypeDef); + .javaTypeForSchemaDefinitionType(baseTypeDef, typeDefinition); } } } @@ -236,11 +236,11 @@ public final class TypeProviderImpl implements TypeProvider { * Seeks for identity reference idref the JAVA * type.
    *
    - * + * * Example:
    * If identy which is referenced via idref has name Idn * then returning type is {@code Class}
    - * + * * @param idref * identityref type definition for which JAVA Type * is sought @@ -269,7 +269,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts typeDefinition to concrete JAVA Type. - * + * * @param typeDefinition * type definition which should be converted to JAVA * Type @@ -282,7 +282,7 @@ public final class TypeProviderImpl implements TypeProvider { *
  • if name of typeDefinition
  • * */ - public Type generatedTypeForExtendedDefinitionType(final TypeDefinition typeDefinition) { + public Type generatedTypeForExtendedDefinitionType(final TypeDefinition typeDefinition, final SchemaNode parentNode) { Type returnType = null; Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!"); if (typeDefinition.getQName() == null) { @@ -297,7 +297,7 @@ public final class TypeProviderImpl implements TypeProvider { final TypeDefinition baseTypeDef = baseTypeDefForExtendedType(typeDefinition); if (!(baseTypeDef instanceof LeafrefTypeDefinition) && !(baseTypeDef instanceof IdentityrefTypeDefinition)) { - final Module module = findParentModuleForTypeDefinition(schemaContext, typeDefinition); + final Module module = findParentModule(schemaContext, parentNode); if (module != null) { final Map genTOs = genTypeDefsContextMap.get(module.getName()); @@ -313,7 +313,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Gets base type definition for extendTypeDef. The method is * recursivelly called until non ExtendedType type is found. - * + * * @param extendTypeDef * type definition for which is the base type definition sought * @return type definition which is base type for extendTypeDef @@ -333,10 +333,10 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts leafrefType to JAVA Type. - * + * * The path of leafrefType is followed to find referenced node * and its Type is returned. - * + * * @param leafrefType * leafref type definition for which is the type sought * @return JAVA Type of data schema node which is referenced in @@ -346,9 +346,9 @@ public final class TypeProviderImpl implements TypeProvider { *
  • if leafrefType equal null
  • *
  • if path statement of leafrefType equal null
  • * - * + * */ - public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType) { + public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType, final SchemaNode parentNode) { Type returnType = null; Preconditions.checkArgument(leafrefType != null, "Leafref Type Definition reference cannot be NULL!"); @@ -362,13 +362,13 @@ public final class TypeProviderImpl implements TypeProvider { if (strXPath.contains("[")) { returnType = Types.typeForClass(Object.class); } else { - final Module module = findParentModuleForTypeDefinition(schemaContext, leafrefType); + final Module module = findParentModule(schemaContext, parentNode); if (module != null) { final DataSchemaNode dataNode; if (xpath.isAbsolute()) { dataNode = findDataSchemaNode(schemaContext, module, xpath); } else { - dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, leafrefType, xpath); + dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, parentNode, xpath); } if (leafContainsEnumDefinition(dataNode)) { @@ -387,7 +387,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Checks if dataNode is LeafSchemaNode and if it * so then checks if it is of type EnumTypeDefinition. - * + * * @param dataNode * data schema node for which is checked if it is leaf and if it * is of enum type @@ -410,7 +410,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Checks if dataNode is LeafListSchemaNode and if * it so then checks if it is of type EnumTypeDefinition. - * + * * @param dataNode * data schema node for which is checked if it is leaflist and if * it is of enum type @@ -435,7 +435,7 @@ public final class TypeProviderImpl implements TypeProvider { * Converts enumTypeDef to * {@link org.opendaylight.yangtools.sal.binding.model.api.Enumeration * enumeration}. - * + * * @param enumTypeDef * enumeration type definition which is converted to enumeration * @param enumName @@ -450,7 +450,7 @@ public final class TypeProviderImpl implements TypeProvider { *
  • if name of enumTypeDef equal null
  • * */ - private Enumeration provideTypeForEnum(final EnumTypeDefinition enumTypeDef, final String enumName) { + private Enumeration provideTypeForEnum(final EnumTypeDefinition enumTypeDef, final String enumName, final SchemaNode parentNode) { Preconditions.checkArgument(enumTypeDef != null, "EnumTypeDefinition reference cannot be NULL!"); Preconditions.checkArgument(enumTypeDef.getValues() != null, "EnumTypeDefinition MUST contain at least ONE value definition!"); @@ -460,7 +460,7 @@ public final class TypeProviderImpl implements TypeProvider { final String enumerationName = parseToClassName(enumName); - Module module = findParentModuleForTypeDefinition(schemaContext, enumTypeDef); + Module module = findParentModule(schemaContext, parentNode); final String basePackageName = moduleNamespaceToPackageName(module); final EnumBuilder enumBuilder = new EnumerationBuilderImpl(basePackageName, enumerationName); @@ -471,7 +471,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Adds enumeration to typeBuilder. The enumeration data are * taken from enumTypeDef. - * + * * @param enumTypeDef * enumeration type definition is source of enumeration data for * typeBuilder @@ -489,7 +489,7 @@ public final class TypeProviderImpl implements TypeProvider { *
  • if name of enumTypeDef equal null
  • *
  • if name of typeBuilder equal null
  • * - * + * */ private Enumeration addInnerEnumerationToTypeBuilder(final EnumTypeDefinition enumTypeDef, final String enumName, final GeneratedTypeBuilder typeBuilder) { @@ -510,7 +510,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts dataNode to JAVA Type. - * + * * @param dataNode * contains information about YANG type * @return JAVA Type representation of dataNode @@ -520,10 +520,10 @@ public final class TypeProviderImpl implements TypeProvider { if (dataNode != null) { if (dataNode instanceof LeafSchemaNode) { final LeafSchemaNode leaf = (LeafSchemaNode) dataNode; - returnType = javaTypeForSchemaDefinitionType(leaf.getType()); + returnType = javaTypeForSchemaDefinitionType(leaf.getType(), leaf); } else if (dataNode instanceof LeafListSchemaNode) { final LeafListSchemaNode leafList = (LeafListSchemaNode) dataNode; - returnType = javaTypeForSchemaDefinitionType(leafList.getType()); + returnType = javaTypeForSchemaDefinitionType(leafList.getType(), leafList); } } return returnType; @@ -532,7 +532,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Passes through all modules and through all its type definitions and * convert it to generated types. - * + * * The modules are firstly sorted by mutual dependencies. The modules are * sequentially passed. All type definitions of a module are at the * beginning sorted so that type definition with less amount of references @@ -541,7 +541,7 @@ public final class TypeProviderImpl implements TypeProvider { * {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap} * which map current module name to the map which maps type names to * returned types (generated types). - * + * */ private void resolveTypeDefsFromContext() { final Set modules = schemaContext.getModules(); @@ -575,7 +575,7 @@ public final class TypeProviderImpl implements TypeProvider { } /** - * + * * @param basePackageName * string with name of package to which the module belongs * @param moduleName @@ -603,11 +603,11 @@ public final class TypeProviderImpl implements TypeProvider { returnType = provideGeneratedTOFromExtendedType(innerExtendedType, basePackageName, typedefName); } else if (innerTypeDefinition instanceof UnionTypeDefinition) { final GeneratedTOBuilder genTOBuilder = provideGeneratedTOBuilderForUnionTypeDef(basePackageName, - typedef, typedefName); + typedef, typedefName, typedef); returnType = genTOBuilder.toInstance(); } else if (innerTypeDefinition instanceof EnumTypeDefinition) { final EnumTypeDefinition enumTypeDef = (EnumTypeDefinition) innerTypeDefinition; - returnType = provideTypeForEnum(enumTypeDef, typedefName); + returnType = provideTypeForEnum(enumTypeDef, typedefName, typedef); } else if (innerTypeDefinition instanceof BitsTypeDefinition) { final BitsTypeDefinition bitsTypeDefinition = (BitsTypeDefinition) innerTypeDefinition; @@ -617,7 +617,7 @@ public final class TypeProviderImpl implements TypeProvider { } else { final Type javaType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER - .javaTypeForSchemaDefinitionType(innerTypeDefinition); + .javaTypeForSchemaDefinitionType(innerTypeDefinition, typedef); returnType = wrapJavaTypeIntoTO(basePackageName, typedef, javaType); } @@ -635,7 +635,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Wraps base YANG type to generated TO. - * + * * @param basePackageName * string with name of package to which the module belongs * @param typedef @@ -670,7 +670,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts output list of generated TO builders to one TO builder (first * from list) which contains the remaining builders as its enclosing TO. - * + * * @param basePackageName * string with name of package to which the module belongs * @param typedef @@ -682,9 +682,9 @@ public final class TypeProviderImpl implements TypeProvider { * builders */ public GeneratedTOBuilder provideGeneratedTOBuilderForUnionTypeDef(final String basePackageName, - final TypeDefinition typedef, String typeDefName) { + final TypeDefinition typedef, String typeDefName, SchemaNode parentNode) { final List genTOBuilders = provideGeneratedTOBuildersForUnionTypeDef(basePackageName, - typedef, typeDefName); + typedef, typeDefName, parentNode); GeneratedTOBuilder resultTOBuilder = null; if (!genTOBuilders.isEmpty()) { resultTOBuilder = genTOBuilders.get(0); @@ -700,7 +700,7 @@ public final class TypeProviderImpl implements TypeProvider { * Converts typedef to generated TO with * typeDefName. Every union type from typedef is * added to generated TO builder as property. - * + * * @param basePackageName * string with name of package to which the module belongs * @param typedef @@ -717,7 +717,7 @@ public final class TypeProviderImpl implements TypeProvider { * */ public List provideGeneratedTOBuildersForUnionTypeDef(final String basePackageName, - final TypeDefinition typedef, final String typeDefName) { + final TypeDefinition typedef, final String typeDefName, final SchemaNode parentNode) { Preconditions.checkArgument(basePackageName != null, "Base Package Name cannot be NULL!"); Preconditions.checkArgument(typedef != null, "Type Definition cannot be NULL!"); if (typedef.getQName() == null) { @@ -747,17 +747,17 @@ public final class TypeProviderImpl implements TypeProvider { final String unionTypeName = unionType.getQName().getLocalName(); if (unionType instanceof UnionType) { generatedTOBuilders - .addAll(resolveUnionSubtypeAsUnion(unionGenTOBuilder, unionType, basePackageName)); + .addAll(resolveUnionSubtypeAsUnion(unionGenTOBuilder, unionType, basePackageName, parentNode)); } else if (unionType instanceof ExtendedType) { resolveExtendedSubtypeAsUnion(unionGenTOBuilder, (ExtendedType) unionType, unionTypeName, - regularExpressions); + regularExpressions, parentNode); } else if (unionType instanceof EnumTypeDefinition) { final Enumeration enumeration = addInnerEnumerationToTypeBuilder((EnumTypeDefinition) unionType, unionTypeName, unionGenTOBuilder); updateUnionTypeAsProperty(unionGenTOBuilder, enumeration, unionTypeName); } else { final Type javaType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER - .javaTypeForSchemaDefinitionType(unionType); + .javaTypeForSchemaDefinitionType(unionType, parentNode); if (javaType != null) { updateUnionTypeAsProperty(unionGenTOBuilder, javaType, unionTypeName); } @@ -767,7 +767,7 @@ public final class TypeProviderImpl implements TypeProvider { addStringRegExAsConstant(unionGenTOBuilder, regularExpressions); } - storeGenTO(typedef, unionGenTOBuilder); + storeGenTO(typedef, unionGenTOBuilder, parentNode); } return generatedTOBuilders; } @@ -775,14 +775,14 @@ public final class TypeProviderImpl implements TypeProvider { /** * Wraps code which handle case when union subtype is also of the type * UnionType. - * + * * In this case the new generated TO is created for union subtype (recursive * call of method * {@link #provideGeneratedTOBuilderForUnionTypeDef(String, TypeDefinition, String) * provideGeneratedTOBuilderForUnionTypeDef} and in parent TO builder * parentUnionGenTOBuilder is created property which type is * equal to new generated TO. - * + * * @param parentUnionGenTOBuilder * generated TO builder to which is the property with the child * union subtype added @@ -795,10 +795,10 @@ public final class TypeProviderImpl implements TypeProvider { * provideGeneratedTOBuildersForUnionTypeDef method. */ private List resolveUnionSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder, - final TypeDefinition unionSubtype, final String basePackageName) { + final TypeDefinition unionSubtype, final String basePackageName, final SchemaNode parentNode) { final String newTOBuilderName = provideAvailableNameForGenTOBuilder(parentUnionGenTOBuilder.getName()); final List subUnionGenTOBUilders = provideGeneratedTOBuildersForUnionTypeDef( - basePackageName, unionSubtype, newTOBuilderName); + basePackageName, unionSubtype, newTOBuilderName, parentNode); final GeneratedPropertyBuilder propertyBuilder; propertyBuilder = parentUnionGenTOBuilder.addProperty(BindingGeneratorUtil @@ -813,11 +813,11 @@ public final class TypeProviderImpl implements TypeProvider { /** * Wraps code which handle case when union subtype is of the type * ExtendedType. - * + * * If TO for this type already exists it is used for the creation of the * property in parentUnionGenTOBuilder. In other case the base * type is used for the property creation. - * + * * @param parentUnionGenTOBuilder * generated TO builder in which new property is created * @param unionSubtype @@ -829,14 +829,14 @@ public final class TypeProviderImpl implements TypeProvider { * list of strings with the regular expressions */ private void resolveExtendedSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder, - final ExtendedType unionSubtype, final String unionTypeName, final List regularExpressions) { - final Type genTO = findGenTO(unionSubtype, unionTypeName); + final ExtendedType unionSubtype, final String unionTypeName, final List regularExpressions, final SchemaNode parentNode) { + final Type genTO = findGenTO(unionSubtype, unionTypeName, parentNode); if (genTO != null) { updateUnionTypeAsProperty(parentUnionGenTOBuilder, genTO, genTO.getName()); } else { final TypeDefinition baseType = baseTypeDefForExtendedType(unionSubtype); if (unionTypeName.equals(baseType.getQName().getLocalName())) { - final Type javaType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(baseType); + final Type javaType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(baseType, parentNode); if (javaType != null) { updateUnionTypeAsProperty(parentUnionGenTOBuilder, javaType, unionTypeName); } @@ -850,7 +850,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Searches for generated TO for searchedTypeDef type * definition in {@link #genTypeDefsContextMap genTypeDefsContextMap} - * + * * @param searchedTypeDef * type definition for which is generatet TO sought * @param searchedTypeName @@ -858,8 +858,8 @@ public final class TypeProviderImpl implements TypeProvider { * @return generated TO for searchedTypeDef or * null it it doesn't exist */ - private Type findGenTO(final TypeDefinition searchedTypeDef, final String searchedTypeName) { - final Module typeModule = findParentModuleForTypeDefinition(schemaContext, searchedTypeDef); + private Type findGenTO(final TypeDefinition searchedTypeDef, final String searchedTypeName, final SchemaNode parentNode) { + final Module typeModule = findParentModule(schemaContext, parentNode); if (typeModule != null && typeModule.getName() != null) { final Map genTOs = genTypeDefsContextMap.get(typeModule.getName()); if (genTOs != null) { @@ -873,17 +873,17 @@ public final class TypeProviderImpl implements TypeProvider { * Stores generated TO created from genTOBuilder for * newTypeDef to {@link #genTypeDefsContextMap * genTypeDefsContextMap} if the module for newTypeDef exists - * + * * @param newTypeDef * type definition for which is genTOBuilder created * @param genTOBuilder * generated TO builder which is converted to generated TO and * stored */ - private void storeGenTO(TypeDefinition newTypeDef, GeneratedTOBuilder genTOBuilder) { + private void storeGenTO(TypeDefinition newTypeDef, GeneratedTOBuilder genTOBuilder, SchemaNode parentNode) { if (!(newTypeDef instanceof UnionType)) { Map genTOsMap = null; - final Module parentModule = findParentModuleForTypeDefinition(schemaContext, newTypeDef); + final Module parentModule = findParentModule(schemaContext, parentNode); if (parentModule != null && parentModule.getName() != null) { genTOsMap = genTypeDefsContextMap.get(parentModule.getName()); genTOsMap.put(newTypeDef.getQName().getLocalName(), genTOBuilder.toInstance()); @@ -894,7 +894,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Adds a new property with the name propertyName and with type * type to unonGenTransObject. - * + * * @param unionGenTransObject * generated TO to which should be property added * @param type @@ -921,7 +921,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts typedef to the generated TO builder. - * + * * @param basePackageName * string with name of package to which the module belongs * @param typedef @@ -946,10 +946,10 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts typeDef which should be of the type * BitsTypeDefinition to GeneratedTOBuilder. - * + * * All the bits of the typeDef are added to returning generated TO as * properties. - * + * * @param basePackageName * string with name of package to which the module belongs * @param typeDef @@ -996,13 +996,13 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts the pattern constraints from typedef to the list of * the strings which represents these constraints. - * + * * @param typedef * extended type in which are the pattern constraints sought * @return list of strings which represents the constraint patterns * @throws IllegalArgumentException * if typedef equals null - * + * */ private List resolveRegExpressionsFromTypedef(ExtendedType typedef) { final List regExps = new ArrayList(); @@ -1024,10 +1024,10 @@ public final class TypeProviderImpl implements TypeProvider { } /** - * + * * Adds to the genTOBuilder the constant which contains regular * expressions from the regularExpressions - * + * * @param genTOBuilder * generated TO builder to which are * regular expressions added @@ -1056,11 +1056,11 @@ public final class TypeProviderImpl implements TypeProvider { * innerExtendedType, about the package name * typedefName and about the generated TO name * typedefName. - * + * * It is supposed that innerExtendedType is already present in * {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap} to * be possible set it as extended type for the returning generated TO. - * + * * @param innerExtendedType * extended type which is part of some other extended type * @param basePackageName @@ -1088,7 +1088,7 @@ public final class TypeProviderImpl implements TypeProvider { final GeneratedTOBuilder genTOBuilder = new GeneratedTOBuilderImpl(basePackageName, classTypedefName); Map typeMap = null; - final Module parentModule = findParentModuleForTypeDefinition(schemaContext, innerExtendedType); + final Module parentModule = findParentModule(schemaContext, innerExtendedType); if (parentModule != null) { typeMap = genTypeDefsContextMap.get(parentModule.getName()); } @@ -1110,7 +1110,7 @@ public final class TypeProviderImpl implements TypeProvider { * equal depth. In next step are lists from this map concatenated to one * list in ascending order according to their depth. All type definitions * are in the list behind all type definitions on which depends. - * + * * @param unsortedTypeDefinitions * list of type definitions which should be sorted by depth * @return list of type definitions sorted according their each other @@ -1144,7 +1144,7 @@ public final class TypeProviderImpl implements TypeProvider { /** * Returns how many immersion is necessary to get from the type definition * to the base type. - * + * * @param typeDefinition * type definition for which is depth sought. * @return number of immersions which are necessary to get from the type @@ -1176,7 +1176,7 @@ public final class TypeProviderImpl implements TypeProvider { * Returns string which contains the same value as name but * integer suffix is incremented by one. If name contains no * number suffix then number 1 is added. - * + * * @param name * string with name of augmented node * @return string with the number suffix incremented by one (or 1 is added)