From 74df9aeb599140227b2bcf4218e8b0119c79aca0 Mon Sep 17 00:00:00 2001 From: Jie Han Date: Thu, 19 Oct 2017 16:18:04 +0800 Subject: [PATCH] Fix checkstyle in mdsal-binding2-generator-impl - - Fix checkstyle issues and activate enforcement. Change-Id: I5fe421e7389e4c3f1c2d809f6321829b9d7559c5 Signed-off-by: Jie Han --- .../mdsal-binding2-generator-impl/pom.xml | 7 + .../generator/impl/AugmentToGenType.java | 7 +- .../generator/impl/AuxiliaryGenUtils.java | 155 ++-- .../generator/impl/BindingGeneratorImpl.java | 2 + .../javav2/generator/impl/GenHelperUtil.java | 690 +++++++++--------- .../generator/impl/ModuleToGenType.java | 101 +-- .../generator/impl/RpcActionGenHelper.java | 112 +-- .../generator/yang/types/BaseYangTypes.java | 34 +- .../GroupingDefinitionDependencySort.java | 2 + .../generator/yang/types/NodeWrappedType.java | 12 +- .../generator/yang/types/TypeGenHelper.java | 139 ++-- .../yang/types/TypeProviderImpl.java | 448 +++++------- .../generator/impl/AugmentToGenTypeTest.java | 4 +- .../generator/impl/AuxiliaryGenUtilsTest.java | 1 + .../impl/BindingGeneratorImplTest.java | 89 ++- .../javav2/generator/impl/Bug8542Test.java | 5 +- .../impl/RpcActionGenHelperTest.java | 3 +- .../generator/impl/UnionTypeDefTest.java | 2 + .../action/examples/MyActionCallInput.java | 2 +- .../action/examples/MyActionCallOutput.java | 2 +- .../MyActionModuleMyActionCallAction.java | 7 +- .../impl/action/examples/MyCont.java | 2 +- .../action/examples/ListActionCallInput.java | 2 +- .../action/examples/ListActionCallOutput.java | 5 +- .../ListActionModuleListActionCall.java | 13 +- .../impl/list/action/examples/MyList.java | 2 +- .../impl/list/action/examples/MyListKey.java | 2 +- .../impl/rpc/examples/MyCallInput.java | 2 +- .../impl/rpc/examples/MyCallOutput.java | 2 +- .../impl/rpc/examples/MyModuleMyCallRpc.java | 6 +- 30 files changed, 911 insertions(+), 949 deletions(-) diff --git a/binding2/mdsal-binding2-generator-impl/pom.xml b/binding2/mdsal-binding2-generator-impl/pom.xml index d891abbe18..cb0c2f3c07 100644 --- a/binding2/mdsal-binding2-generator-impl/pom.xml +++ b/binding2/mdsal-binding2-generator-impl/pom.xml @@ -104,6 +104,13 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.violationSeverity=error + + diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java index 30a85e9b84..beb9f5ab53 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenType.java @@ -135,7 +135,8 @@ final class AugmentToGenType { sortedAugmentationsGrouped.sort(AUGMENTS_COMP); //process child nodes of grouped augment entries - for (Map.Entry> schemaPathAugmentListEntry : sortedAugmentationsGrouped) { + for (Map.Entry> schemaPathAugmentListEntry + : sortedAugmentationsGrouped) { resultCtx = augmentationToGenTypes(basePackageName, schemaPathAugmentListEntry, module, schemaContext, verboseClassComments, resultCtx, genTypeBuilders, typeProvider); @@ -256,6 +257,7 @@ final class AugmentToGenType { /** * Convenient method to find node added by uses statement. * @param schemaContext + * actual schema context * @param targetPath * node path * @param parentUsesNode @@ -318,7 +320,7 @@ final class AugmentToGenType { } } else { throw new IllegalStateException( - "Target node of uses-augment statement must be DataSchemaNode. Failed to generate code for augment in " + "Target node of uses-augment statement must be DataSchemaNode. Failed to generate code for augment in " + parentUsesNode); } } @@ -328,6 +330,7 @@ final class AugmentToGenType { * added to the choice through the augment. * * @param schemaContext + * actual schema context * @param module * current module * @param basePackageName diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtils.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtils.java index 0f1792534d..f67342b5aa 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtils.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtils.java @@ -15,10 +15,12 @@ import static org.opendaylight.mdsal.binding.javav2.generator.util.Types.BOOLEAN import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Splitter; + import java.util.Collection; import java.util.List; import java.util.Map; import java.util.regex.Pattern; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider; import org.opendaylight.mdsal.binding.javav2.generator.util.JavaIdentifier; @@ -57,7 +59,7 @@ import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition; /** - * Auxiliary util class for {@link GenHelperUtil} class + * Auxiliary util class for {@link GenHelperUtil} class. */ @Beta final class AuxiliaryGenUtils { @@ -95,27 +97,24 @@ final class AuxiliaryGenUtils { * Created a method signature builder as part of * interfaceBuilder. * + *

* The method signature builder is created for the getter method of * schemaNodeName. Also comment and * returnType information are added to the builder. * - * @param interfaceBuilder - * generated type builder for which the getter method should be - * created - * @param schemaNodeName - * string with schema node name. The name will be the part of the - * getter method name. - * @param comment - * string with comment for the getter method - * @param returnType - * type which represents the return type of the getter method - * @param status - * status from yang file, for deprecated annotation + * @param interfaceBuilder generated type builder for which the getter method should be + * created + * @param schemaNodeName string with schema node name. The name will be the part of the + * getter method name. + * @param comment string with comment for the getter method + * @param returnType type which represents the return type of the getter method + * @param status status from yang file, for deprecated annotation * @return method signature builder which represents the getter method of - * interfaceBuilder + * interfaceBuilder */ static MethodSignatureBuilder constructGetter(final GeneratedTypeBuilder interfaceBuilder, - final String schemaNodeName, final String comment, final Type returnType, final Status status) { + final String schemaNodeName, final String comment, final Type + returnType, final Status status) { final MethodSignatureBuilder getMethod = interfaceBuilder .addMethod(getterMethodName(schemaNodeName, returnType)); @@ -130,12 +129,10 @@ final class AuxiliaryGenUtils { /** * Creates the name of the getter method name from localName. * - * @param localName - * string with the name of the getter method - * @param returnType - * return type + * @param localName string with the name of the getter method + * @param returnType return type * @return string with the name of the getter method for - * methodName in JAVA method format + * methodName in JAVA method format */ @VisibleForTesting static String getterMethodName(final String localName, final Type returnType) { @@ -146,14 +143,14 @@ final class AuxiliaryGenUtils { method.append("get"); } return method.append(JavaIdentifierNormalizer.normalizeSpecificIdentifier(localName, JavaIdentifier.CLASS)) - .toString(); + .toString(); } public static boolean hasBuilderClass(final SchemaNode schemaNode, final BindingNamespaceType namespaceType) { return (BindingNamespaceType.isData(namespaceType) - && (schemaNode instanceof ContainerSchemaNode || schemaNode instanceof ListSchemaNode - || schemaNode instanceof RpcDefinition || schemaNode instanceof NotificationDefinition - || schemaNode instanceof CaseSchemaNode)); + && (schemaNode instanceof ContainerSchemaNode || schemaNode instanceof ListSchemaNode + || schemaNode instanceof RpcDefinition || schemaNode instanceof NotificationDefinition + || schemaNode instanceof CaseSchemaNode)); } @VisibleForTesting @@ -166,11 +163,9 @@ final class AuxiliaryGenUtils { * generated type builder name for augment consists from name of augmented * node and serial number of its augmentation. * - * @param builders - * map of builders which were created in the package to which the - * augmentation belongs - * @param genTypeName - * string with name of augmented node + * @param builders map of builders which were created in the package to which the + * augmentation belongs + * @param genTypeName string with name of augmented node * @return string with unique name for augmentation builder */ static String augGenTypeName(final Map builders, final String genTypeName) { @@ -184,6 +179,8 @@ final class AuxiliaryGenUtils { } /** + * Return augment identifier. + * * @param unknownSchemaNodes unknown schema nodes * @return nodeParameter of UnknownSchemaNode */ @@ -202,23 +199,21 @@ final class AuxiliaryGenUtils { * Adds enumeration builder created from enumTypeDef to * typeBuilder. * + *

* Each enumTypeDef item is added to builder with its name and * value. * - * @param enumTypeDef - * EnumTypeDefinition contains enum data - * @param enumName - * string contains name which will be assigned to enumeration - * builder - * @param typeBuilder - * GeneratedTypeBuilder to which will be enum builder assigned - * @param module - * Module in which type should be generated + * @param enumTypeDef EnumTypeDefinition contains enum data + * @param enumName string contains name which will be assigned to enumeration + * builder + * @param typeBuilder GeneratedTypeBuilder to which will be enum builder assigned + * @param module Module in which type should be generated * @return enumeration builder which contains data from - * enumTypeDef + * enumTypeDef */ static EnumBuilder resolveInnerEnumFromTypeDefinition(final EnumTypeDefinition enumTypeDef, final QName enumName, - final Map genCtx, final GeneratedTypeBuilder typeBuilder, final Module module) { + final Map genCtx, final + GeneratedTypeBuilder typeBuilder, final Module module) { if (enumTypeDef != null && typeBuilder != null && enumTypeDef.getQName().getLocalName() != null) { final EnumBuilder enumBuilder = typeBuilder.addEnumeration(enumName.getLocalName(), genCtx.get(module)); final String enumTypedefDescription = encodeAngleBrackets(enumTypeDef.getDescription().orElse(null)); @@ -237,33 +232,30 @@ final class AuxiliaryGenUtils { * {@link UnionTypeDefinition} or {@link BitsTypeDefinition} which are * also added to typeBuilder as enclosing transfer object. * + *

* If more then one generated TO builder is created for enclosing then all * of the generated TO builders are added to typeBuilder as * enclosing transfer objects. * - * @param typeDef - * type definition which can be of type UnionType or - * BitsTypeDefinition - * @param typeBuilder - * generated type builder to which is added generated TO created - * from typeDef - * @param leaf - * string with name for generated TO builder - * @param parentModule - * parent module + * @param typeDef type definition which can be of type UnionType or + * BitsTypeDefinition + * @param typeBuilder generated type builder to which is added generated TO created + * from typeDef + * @param leaf string with name for generated TO builder + * @param parentModule parent module * @return generated TO builder for typeDef */ static GeneratedTOBuilder addTOToTypeBuilder(final TypeDefinition typeDef, final GeneratedTypeBuilder typeBuilder, final DataSchemaNode leaf, final Module parentModule, final TypeProvider typeProvider, - final SchemaContext schemaContext, ModuleContext context, final Map genCtx) { + final SchemaContext schemaContext, ModuleContext context, final + Map genCtx) { final String classNameFromLeaf = leaf.getQName().getLocalName(); GeneratedTOBuilder genTOBuilder = null; final String packageName = typeBuilder.getFullyQualifiedName(); if (typeDef instanceof UnionTypeDefinition) { genTOBuilder = ((TypeProviderImpl) typeProvider) .provideGeneratedTOBuilderForUnionTypeDef(packageName, ((UnionTypeDefinition) typeDef), - classNameFromLeaf, leaf, schemaContext, - ((TypeProviderImpl) typeProvider).getGenTypeDefsContextMap(), context); + classNameFromLeaf, leaf, context); } else if (typeDef instanceof BitsTypeDefinition) { genTOBuilder = (((TypeProviderImpl) typeProvider)).provideGeneratedTOBuilderForBitsTypeDefinition( packageName, typeDef, classNameFromLeaf, parentModule.getName(), context); @@ -277,10 +269,11 @@ final class AuxiliaryGenUtils { } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) static Type createReturnTypeForUnion(final GeneratedTOBuilder genTOBuilder, final TypeDefinition typeDef, - final GeneratedTypeBuilder typeBuilder, final Module parentModule, final TypeProvider typeProvider, - final boolean verboseClassComments) { + final GeneratedTypeBuilder typeBuilder, final Module parentModule, final + TypeProvider typeProvider, + final boolean verboseClassComments) { final GeneratedTOBuilderImpl returnType = (GeneratedTOBuilderImpl) genTOBuilder; if (verboseClassComments) { @@ -308,16 +301,14 @@ final class AuxiliaryGenUtils { * Generates for the list which contains any list keys special * generated TO builder. * - * @param packageName - * string with package name to which the list belongs - * @param list - * schema node of list + * @param packageName string with package name to which the list belongs + * @param list schema node of list * @return generated TO builder which represents the keys of the - * list or empty TO builder if list is null or list of - * key definitions is null or empty. + * list or empty TO builder if list is null or list of + * key definitions is null or empty. */ static GeneratedTOBuilder resolveListKeyTOBuilder(final String packageName, final ListSchemaNode list, - ModuleContext context) { + ModuleContext context) { GeneratedTOBuilder genTOBuilder = null; if ((list.getKeyDefinition() != null) && (!list.getKeyDefinition().isEmpty())) { // underscore used as separator for distinction of class name parts @@ -330,7 +321,7 @@ final class AuxiliaryGenUtils { } static GeneratedTypeBuilder resolveListKeyTypeBuilder(final String packageName, final ListSchemaNode list, - ModuleContext context) { + ModuleContext context) { GeneratedTypeBuilder genTypeBuilder = null; if ((list.getKeyDefinition() != null) && (!list.getKeyDefinition().isEmpty())) { // underscore used as separator for distinction of class name parts @@ -346,25 +337,22 @@ final class AuxiliaryGenUtils { * Converts leaf schema node to property of generated TO * builder. * - * @param toBuilder - * generated TO builder to which is leaf added as - * property - * @param leaf - * leaf schema node which is added to toBuilder as - * property - * @param returnType - * property type - * @param isReadOnly - * boolean value which says if leaf property is|isn't read only + * @param toBuilder generated TO builder to which is leaf added as + * property + * @param leaf leaf schema node which is added to toBuilder as + * property + * @param returnType property type + * @param isReadOnly boolean value which says if leaf property is|isn't read only * @return boolean value - *

    - *
  • false - if leaf, toBuilder or leaf - * name equals null or if leaf is added by uses.
  • - *
  • true - other cases
  • - *
+ *
    + *
  • false - if leaf, toBuilder or leaf + * name equals null or if leaf is added by uses.
  • + *
  • true - other cases
  • + *
*/ - static boolean resolveLeafSchemaNodeAsProperty(final String nodeName, final GeneratedTOBuilder toBuilder, final LeafSchemaNode leaf, - final Type returnType, final boolean isReadOnly) { + static boolean resolveLeafSchemaNodeAsProperty(final String nodeName, final GeneratedTOBuilder toBuilder, + final LeafSchemaNode leaf, final Type returnType, final boolean + isReadOnly) { if (returnType == null) { return false; @@ -382,7 +370,8 @@ final class AuxiliaryGenUtils { final String leafDesc = encodeAngleBrackets(leaf.getDescription().orElse(null)); final GeneratedPropertyBuilder propBuilder = - toBuilder.addProperty(JavaIdentifierNormalizer.normalizeSpecificIdentifier(leafGetterName, JavaIdentifier.METHOD)); + toBuilder.addProperty(JavaIdentifierNormalizer.normalizeSpecificIdentifier(leafGetterName, + JavaIdentifier.METHOD)); propBuilder.setReadOnly(isReadOnly); propBuilder.setReturnType(returnType); propBuilder.setComment(leafDesc); @@ -398,7 +387,7 @@ final class AuxiliaryGenUtils { } @VisibleForTesting - public static String replaceAllIllegalChars(final StringBuilder stringBuilder){ + public static String replaceAllIllegalChars(final StringBuilder stringBuilder) { final String ret = UNICODE_CHAR_PATTERN.matcher(stringBuilder).replaceAll("\\\\\\\\u"); return ret.isEmpty() ? "" : ret; } diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImpl.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImpl.java index b2ff07305e..cbb4bb2e02 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImpl.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImpl.java @@ -66,6 +66,7 @@ public class BindingGeneratorImpl implements BindingGenerator { /** * Resolves generated types from context schema nodes of all modules. * + *

* Generated types are created for modules, groupings, types, containers, lists, choices, augments, rpcs, * notification, identities. * @@ -87,6 +88,7 @@ public class BindingGeneratorImpl implements BindingGenerator { * Resolves generated types from context schema nodes only for * modules specified in modules * + *

* Generated types are created for modules, groupings, types, containers, * lists, choices, augments, rpcs, notification, identities. * diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/GenHelperUtil.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/GenHelperUtil.java index 64d54c48a6..b65758a6cd 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/GenHelperUtil.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/GenHelperUtil.java @@ -32,6 +32,7 @@ import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findP import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; + import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -39,6 +40,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import javax.annotation.Nullable; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider; import org.opendaylight.mdsal.binding.javav2.generator.util.BindingGeneratorUtil; @@ -111,17 +113,15 @@ final class GenHelperUtil { /** * Create GeneratedTypeBuilder object from module argument. * - * @param module - * Module object from which builder will be created - * @param genCtx generated context + * @param module Module object from which builder will be created + * @param genCtx generated context * @param verboseClassComments verbosity switch - * * @return GeneratedTypeBuilder which is internal - * representation of the module - * @throws IllegalArgumentException - * if module is null + * representation of the module + * @throws IllegalArgumentException if module is null */ - static GeneratedTypeBuilder moduleToDataType(final Module module, final Map genCtx, final boolean verboseClassComments) { + static GeneratedTypeBuilder moduleToDataType(final Module module, final Map genCtx, + final boolean verboseClassComments) { Preconditions.checkArgument(module != null, "Module reference cannot be NULL."); final GeneratedTypeBuilder moduleDataTypeBuilder = moduleTypeBuilder(module, "Data", verboseClassComments, @@ -142,17 +142,14 @@ final class GenHelperUtil { /** * Generates type builder for module. * - * @param module - * Module which is source of package name for generated type - * builder - * @param postfix - * string which is added to the module class name representation - * as suffix + * @param module Module which is source of package name for generated type + * builder + * @param postfix string which is added to the module class name representation + * as suffix * @param verboseClassComments verbosity switch * @return instance of GeneratedTypeBuilder which represents - * module. - * @throws IllegalArgumentException - * if module is null + * module. + * @throws IllegalArgumentException if module is null */ static GeneratedTypeBuilder moduleTypeBuilder(final Module module, final String postfix, final boolean verboseClassComments, final ModuleContext context) { @@ -175,34 +172,34 @@ final class GenHelperUtil { /** * Adds the implemented types to type builder. * + *

* The method passes through the list of uses in * {@code dataNodeContainer}. For every use is obtained corresponding * generated type from all groupings * allGroupings} which is added as implements type to * builder * - * @param dataNodeContainer - * element which contains the list of used YANG groupings - * @param builder - * builder to which are added implemented types according to - * dataNodeContainer - * @param genCtx generated context + * @param dataNodeContainer element which contains the list of used YANG groupings + * @param builder builder to which are added implemented types according to + * dataNodeContainer + * @param genCtx generated context * @return generated type builder with all implemented types */ static GeneratedTypeBuilder addImplementedInterfaceFromUses(final DataNodeContainer dataNodeContainer, - final GeneratedTypeBuilder builder, final Map genCtx) { + final GeneratedTypeBuilder builder, final Map genCtx) { for (final UsesNode usesNode : dataNodeContainer.getUses()) { final GeneratedType genType = findGroupingByPath(usesNode.getGroupingPath(), genCtx).toInstance(); if (genType == null) { throw new IllegalStateException("Grouping " + usesNode.getGroupingPath() + "is not resolved for " - + builder.getName()); + + builder.getName()); } builder.addImplementsType(genType); } return builder; } - static GeneratedTypeBuilder findGroupingByPath(final SchemaPath path, final Map genCtx) { + static GeneratedTypeBuilder findGroupingByPath(final SchemaPath path, final Map genCtx) { for (final ModuleContext ctx : genCtx.values()) { final GeneratedTypeBuilder result = ctx.getGrouping(path); if (result != null) { @@ -210,7 +207,7 @@ final class GenHelperUtil { } } return null; - } + } static GeneratedTypeBuilder findIdentityByQname(final QName qname, final Map genCtx) { for (final ModuleContext ctx : genCtx.values()) { @@ -226,33 +223,34 @@ final class GenHelperUtil { * Adds the methods to typeBuilder which represent subnodes of * node for which typeBuilder was created. * + *

* The subnodes aren't mapped to the methods if they are part of grouping or * augment (in this case are already part of them). * - * @param module - * current module - * @param basePackageName - * string contains the module package name - * @param parent - * generated type builder which represents any node. The subnodes - * of this node are added to the typeBuilder as - * methods. The subnode can be of type leaf, leaf-list, list, - * container, choice. - * @param childOf - * parent type - * @param schemaNodes - * set of data schema nodes which are the children of the node - * for which typeBuilder was created + * @param module current module + * @param basePackageName string contains the module package name + * @param parent generated type builder which represents any node. The subnodes + * of this node are added to the typeBuilder as + * methods. The subnode can be of type leaf, leaf-list, list, + * container, choice. + * @param childOf parent type + * @param schemaNodes set of data schema nodes which are the children of the node + * for which typeBuilder was created * @return generated type builder which is the same builder as input - * parameter. The getter methods (representing child nodes) could be - * added to it. + * parameter. The getter methods (representing child nodes) could be + * added to it. */ static GeneratedTypeBuilder resolveDataSchemaNodes(final Module module, final String basePackageName, - final GeneratedTypeBuilder parent, final GeneratedTypeBuilder childOf, - final Iterable schemaNodes, final Map genCtx, - final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, - final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { + final GeneratedTypeBuilder parent, final GeneratedTypeBuilder + childOf, + final Iterable schemaNodes, final Map genCtx, + final SchemaContext schemaContext, final boolean + verboseClassComments, + final Map> + genTypeBuilders, + final TypeProvider typeProvider, final BindingNamespaceType + namespaceType) { if (schemaNodes != null && parent != null) { for (final DataSchemaNode schemaNode : schemaNodes) { @@ -266,7 +264,7 @@ final class GenHelperUtil { } static boolean resolveDataSchemaNodesCheck(final Module module, final SchemaContext schemaContext, - final DataSchemaNode schemaNode) { + final DataSchemaNode schemaNode) { if (!schemaNode.isAugmenting()) { return true; } @@ -276,7 +274,8 @@ final class GenHelperUtil { return module.equals(originalModule); } - private static QName createQNameFromSuperNode(final Module module, final Object node, final SchemaNode superChildNode) { + private static QName createQNameFromSuperNode(final Module module, final Object node, final SchemaNode + superChildNode) { QName childNodeQName = null; if (node instanceof Module) { childNodeQName = QName.create(((Module) node).getQNameModule(), superChildNode.getQName().getLocalName()); @@ -292,8 +291,9 @@ final class GenHelperUtil { } private static void addUsesImplements(final SchemaNode superNode, final Module superModule, - final Object node, final Module module, final SchemaContext schemaContext, - final Map genCtx, final BindingNamespaceType namespaceType) { + final Object node, final Module module, final SchemaContext schemaContext, + final Map genCtx, final BindingNamespaceType + namespaceType) { if (superNode instanceof DataNodeContainer) { for (DataSchemaNode superChildNode : ((DataNodeContainer) superNode).getChildNodes()) { if (superChildNode instanceof DataNodeContainer || superChildNode instanceof ChoiceSchemaNode) { @@ -302,7 +302,8 @@ final class GenHelperUtil { Preconditions.checkNotNull(childNode, "%s->%s", node, childQName); final GeneratedTypeBuilder type = genCtx.get(module).getChildNode(childNode.getPath()); - final GeneratedTypeBuilder superType = genCtx.get(superModule).getChildNode(superChildNode.getPath()); + final GeneratedTypeBuilder superType = genCtx.get(superModule).getChildNode(superChildNode + .getPath()); Preconditions.checkNotNull(type, "%s->%s", module, childNode.getPath()); Preconditions.checkNotNull(superType, "%s->%s", superModule, superChildNode.getPath()); @@ -317,7 +318,8 @@ final class GenHelperUtil { .addImplementsType(genCtx.get(superModule).getKeyType(superChildNode.getPath())); } } - addUsesImplements(superChildNode, superModule, childNode, module, schemaContext, genCtx, namespaceType); + addUsesImplements(superChildNode, superModule, childNode, module, schemaContext, genCtx, + namespaceType); } } } else if (superNode instanceof ChoiceSchemaNode) { @@ -339,11 +341,11 @@ final class GenHelperUtil { } private static GroupingDefinition findGroupingNodeFromUses(final Module module, final SchemaContext schemaContext, - final Object parentNode, final UsesNode usesNode) { + final Object parentNode, final UsesNode usesNode) { SchemaNode groupingNode; if (parentNode instanceof Module) { final Module superModule = schemaContext.findModule( - usesNode.getGroupingPath().getLastComponent().getModule()).get(); + usesNode.getGroupingPath().getLastComponent().getModule()).get(); groupingNode = superModule.getGroupings() .stream().filter(grouping -> grouping.getPath().equals(usesNode.getGroupingPath())) .findFirst().orElse(null); @@ -364,12 +366,13 @@ final class GenHelperUtil { Preconditions.checkNotNull(groupingNode, "%s->%s", module, usesNode.getGroupingPath()); Preconditions.checkState(groupingNode instanceof GroupingDefinition, "%s->%s", module, - usesNode.getGroupingPath()); + usesNode.getGroupingPath()); return (GroupingDefinition) groupingNode; } static Map processUsesImplements(final Object node, final Module module, - final SchemaContext schemaContext, final Map genCtx, final BindingNamespaceType namespaceType) { + final SchemaContext schemaContext, final Map genCtx, final BindingNamespaceType namespaceType) { if (node instanceof DataNodeContainer) { for (final UsesNode usesNode : ((DataNodeContainer) node).getUses()) { final GroupingDefinition grouping = findGroupingNodeFromUses(module, schemaContext, node, usesNode); @@ -402,18 +405,14 @@ final class GenHelperUtil { static Map addRawAugmentGenTypeDefinition(final Module module, final String augmentPackageName, final GeneratedTypeBuilder targetTypeBuilder, final SchemaNode targetNode, - final List schemaPathAugmentListEntry, - final Map> genTypeBuilders, - final Map genCtx, final SchemaContext schemaContext, - final boolean verboseClassComments, final TypeProvider typeProvider, + final List schemaPathAugmentListEntry, final Map> genTypeBuilders, final Map genCtx, + final SchemaContext schemaContext, final boolean verboseClassComments, final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { //pick augmentation grouped by augmentation target, there is always at least one final AugmentationSchemaNode augSchema = schemaPathAugmentListEntry.get(0); - Map augmentBuilders = genTypeBuilders.computeIfAbsent( - augmentPackageName, k -> new HashMap<>()); - //this requires valid semantics in YANG model String augIdentifier = null; for (AugmentationSchemaNode aug : schemaPathAugmentListEntry) { @@ -453,13 +452,16 @@ final class GenHelperUtil { //apply all uses addImplementedInterfaceFromUses(aug, augTypeBuilder, genCtx); augSchemaNodeToMethods(module, BindingMapping.getRootPackageName(module), augTypeBuilder, childOf, - aug.getChildNodes(), genCtx, schemaContext, verboseClassComments, typeProvider, genTypeBuilders, - targetTypeBuilder.getBindingNamespaceType()); + aug.getChildNodes(), genCtx, schemaContext, verboseClassComments, typeProvider, genTypeBuilders, + targetTypeBuilder.getBindingNamespaceType()); } + final Map augmentBuilders = genTypeBuilders.computeIfAbsent( + augmentPackageName, k -> new HashMap<>()); + augmentBuilders.put(augTypeBuilder.getName(), augTypeBuilder); - if(!augSchema.getChildNodes().isEmpty()) { + if (!augSchema.getChildNodes().isEmpty()) { genCtx.get(module).addTargetToAugmentation(augTypeBuilder, augSchema.getTargetPath()); } genCtx.get(module).addAugmentType(augTypeBuilder); @@ -471,28 +473,25 @@ final class GenHelperUtil { * Adds the methods to typeBuilder what represents subnodes of * node for which typeBuilder was created. * - * @param module - * current module - * @param basePackageName - * string contains the module package name - * @param typeBuilder - * generated type builder which represents any node. The subnodes - * of this node are added to the typeBuilder as - * methods. The subnode can be of type leaf, leaf-list, list, - * container, choice. - * @param childOf - * parent type - * @param schemaNodes - * set of data schema nodes which are the children of the node - * for which typeBuilder was created - * @return generated type builder which is the same object as the input - * parameter typeBuilder. The getter method could be - * added to it. + * @param module current module + * @param basePackageName string contains the module package name + * @param typeBuilder generated type builder which represents any node. The subnodes + * of this node are added to the typeBuilder as + * methods. The subnode can be of type leaf, leaf-list, list, + * container, choice. + * @param childOf parent type + * @param schemaNodes set of data schema nodes which are the children of the node + * for which typeBuilder was created + * @return generated type builder which is the same object as the input added to it. */ private static GeneratedTypeBuilder augSchemaNodeToMethods(final Module module, final String basePackageName, - final GeneratedTypeBuilder typeBuilder, final GeneratedTypeBuilder childOf, final Iterable schemaNodes, - final Map genCtx, final SchemaContext schemaContext, final boolean - verboseClassComments, final TypeProvider typeProvider, final Map schemaNodes, + final Map genCtx, final + SchemaContext schemaContext, final boolean + verboseClassComments, final TypeProvider + typeProvider, final Map> genTypeBuilders, final BindingNamespaceType namespaceType) { if (schemaNodes != null && typeBuilder != null) { for (final DataSchemaNode schemaNode : schemaNodes) { @@ -509,6 +508,7 @@ final class GenHelperUtil { * Instantiates generated type builder with packageName and * schemaNode. * + *

* The new builder always implements * {@link TreeNode TreeNode}.
* If schemaNode is instance of GroupingDefinition it also @@ -519,20 +519,20 @@ final class GenHelperUtil { * DataNodeContainer} it can also implement nodes which are specified in * uses. * - * @param basePackageName - * string contains the module package name - * @param schemaNode - * schema node for which is created generated type builder - * @param childOf - * parent generated type of data tree node, which should be - * set null if current schema node is not a data tree node. - * @param schemaContext schema context + * @param basePackageName string contains the module package name + * @param schemaNode schema node for which is created generated type builder + * @param childOf parent generated type of data tree node, which should be + * set null if current schema node is not a data tree node. + * @param schemaContext schema context * @return generated type builder schemaNode */ public static GeneratedTypeBuilder addDefaultInterfaceDefinition(final String basePackageName, final SchemaNode schemaNode, @Nullable final Type childOf, final Module module, final Map genCtx, - final SchemaContext schemaContext, final boolean verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { + final SchemaContext schemaContext, final boolean + verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider, final BindingNamespaceType + namespaceType) { GeneratedTypeBuilder it = addRawInterfaceDefinition(basePackageName, schemaNode, schemaContext, "", "", verboseClassComments, genTypeBuilders, namespaceType, genCtx.get(module)); @@ -540,10 +540,10 @@ final class GenHelperUtil { if (childOf == null) { it.addImplementsType(BindingTypes.TREE_NODE); } else { - if (!(schemaNode instanceof ListSchemaNode) || - ((ListSchemaNode) schemaNode).getKeyDefinition().isEmpty()) { + if (!(schemaNode instanceof ListSchemaNode) + || ((ListSchemaNode) schemaNode).getKeyDefinition().isEmpty()) { it.addImplementsType(parameterizedTypeFor(BindingTypes.TREE_CHILD_NODE, childOf, - parameterizedTypeFor(BindingTypes.ITEM, it))); + parameterizedTypeFor(BindingTypes.ITEM, it))); } } @@ -565,11 +565,14 @@ final class GenHelperUtil { static GeneratedTypeBuilder resolveNotification(final GeneratedTypeBuilder listenerInterface, final String parentName, final String basePackageName, final NotificationDefinition notification, final Module module, - final SchemaContext schemaContext, final boolean verboseClassComments, final Map> - genTypeBuilders, final TypeProvider typeProvider, final Map genCtx) { - final GeneratedTypeBuilder notificationInterface = addDefaultInterfaceDefinition - (basePackageName, notification, null, module, genCtx, schemaContext, - verboseClassComments, genTypeBuilders, typeProvider, BindingNamespaceType.Notification); + final SchemaContext schemaContext, final boolean + verboseClassComments, final Map> + genTypeBuilders, final TypeProvider typeProvider, final + Map genCtx) { + final GeneratedTypeBuilder notificationInterface = addDefaultInterfaceDefinition(basePackageName, notification, + null, module, genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, + BindingNamespaceType.Notification); annotateDeprecatedIfNecessary(notification.getStatus(), notificationInterface); notificationInterface.addImplementsType(NOTIFICATION); genCtx.get(module).addChildNodeType(notification, notificationInterface); @@ -586,7 +589,8 @@ final class GenHelperUtil { } sb.append(notificationInterface.getName()); - listenerInterface.addMethod(JavaIdentifierNormalizer.normalizeSpecificIdentifier(sb.toString(), JavaIdentifier.METHOD)) + listenerInterface.addMethod(JavaIdentifierNormalizer.normalizeSpecificIdentifier(sb.toString(), + JavaIdentifier.METHOD)) .setAccessModifier(AccessModifier.PUBLIC).addParameter(notificationInterface, "notification") .setComment(encodeAngleBrackets(notification.getDescription().orElse(null))).setReturnType(Types.VOID); return listenerInterface; @@ -596,31 +600,30 @@ final class GenHelperUtil { * Returns reference to generated type builder for specified * schemaNode with packageName. * + *

* Firstly the generated type builder is searched in * {@link BindingGeneratorImpl#genTypeBuilders genTypeBuilders}. If it isn't * found it is created and added to genTypeBuilders. * - * @param basePackageName - * string contains the module package name - * @param schemaNode - * schema node which provide data about the schema node name - * @param schemaContext schema context - * @param prefix - * return type name prefix + * @param basePackageName string contains the module package name + * @param schemaNode schema node which provide data about the schema node name + * @param schemaContext schema context + * @param prefix return type name prefix * @return generated type builder for schemaNode - * @throws IllegalArgumentException - *

    - *
  • if schemaNode is null
  • - *
  • if packageName is null
  • - *
  • if QName of schema node is null
  • - *
  • if schemaNode name is null
  • - *
- * + * @throws IllegalArgumentException
    + *
  • if schemaNode is null
  • + *
  • if packageName is null
  • + *
  • if QName of schema node is null
  • + *
  • if schemaNode name is null
  • + *
*/ static GeneratedTypeBuilder addRawInterfaceDefinition(final String basePackageName, final SchemaNode schemaNode, - final SchemaContext schemaContext, final String prefix, final String suffix, - final boolean verboseClassComments, final Map> genTypeBuilders, - final BindingNamespaceType namespaceType, final ModuleContext context) { + final SchemaContext schemaContext, final String prefix, + final String suffix, + final boolean verboseClassComments, final Map> genTypeBuilders, + final BindingNamespaceType namespaceType, final + ModuleContext context) { Preconditions.checkArgument(schemaNode != null, "Data Schema Node cannot be NULL."); Preconditions.checkArgument(basePackageName != null, "Base package Name for Generated Type cannot be NULL."); @@ -668,10 +671,13 @@ final class GenHelperUtil { } private static void addSchemaNodeToBuilderAsMethod(final String basePackageName, final DataSchemaNode node, - final GeneratedTypeBuilder typeBuilder, final GeneratedTypeBuilder childOf, final Module module, - final Map genCtx, final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, final TypeProvider typeProvider, - final BindingNamespaceType namespaceType) { + final GeneratedTypeBuilder typeBuilder, final + GeneratedTypeBuilder childOf, final Module module, + final Map genCtx, final SchemaContext + schemaContext, final boolean verboseClassComments, + final Map> + genTypeBuilders, final TypeProvider typeProvider, + final BindingNamespaceType namespaceType) { if (node != null && typeBuilder != null) { if (node instanceof ContainerSchemaNode) { @@ -679,7 +685,7 @@ final class GenHelperUtil { schemaContext, verboseClassComments, genCtx, genTypeBuilders, typeProvider, namespaceType); } else if (node instanceof LeafListSchemaNode) { resolveLeafListSchemaNode(schemaContext, typeBuilder, (LeafListSchemaNode) node, module, - typeProvider, genCtx, verboseClassComments); + typeProvider, genCtx, verboseClassComments); } else if (node instanceof LeafSchemaNode) { resolveLeafSchemaNodeAsMethod("", schemaContext, typeBuilder, genCtx, (LeafSchemaNode) node, module, typeProvider, verboseClassComments); @@ -699,36 +705,32 @@ final class GenHelperUtil { * Converts choiceNode to the list of generated types for * choice and its cases. * + *

* The package names for choice and for its cases are created as * concatenation of the module package (basePackageName) and * names of all parents node. * - * @param module - * current module - * @param basePackageName - * string with the module package name - * @param parent - * parent type - * @param choiceNode - * choice node which is mapped to generated type. Also child - * nodes - cases are mapped to generated types. - * @throws IllegalArgumentException - *

    - *
  • if basePackageName is null
  • - *
  • if choiceNode is null
  • - *
+ * @param module current module + * @param basePackageName string with the module package name + * @param parent parent type + * @param choiceNode choice node which is mapped to generated type. Also child + * nodes - cases are mapped to generated types. + * @throws IllegalArgumentException
    + *
  • if basePackageName is null
  • + *
  • if choiceNode is null
  • + *
*/ private static void choiceToGenType(final Module module, final SchemaContext schemaContext, final boolean verboseClasssComments, final String basePackageName, final GeneratedTypeBuilder parent, - final GeneratedTypeBuilder childOf, final ChoiceSchemaNode choiceNode, - final Map> genTypeBuilders, - final Map genCtx, final TypeProvider typeProvider, - final BindingNamespaceType namespaceType) { + final GeneratedTypeBuilder childOf, final ChoiceSchemaNode choiceNode, + final Map> genTypeBuilders, + final Map genCtx, final TypeProvider typeProvider, + final BindingNamespaceType namespaceType) { checkArgument(basePackageName != null, "Base Package Name cannot be NULL."); checkArgument(choiceNode != null, "Choice Schema Node cannot be NULL."); final GeneratedTypeBuilder choiceTypeBuilder = addRawInterfaceDefinition(basePackageName, choiceNode, - schemaContext, "", "", verboseClasssComments, genTypeBuilders, namespaceType, genCtx.get(module)); + schemaContext, "", "", verboseClasssComments, genTypeBuilders, namespaceType, genCtx.get(module)); constructGetter(parent, choiceNode.getQName().getLocalName(), choiceNode.getDescription().orElse(null), choiceTypeBuilder, choiceNode.getStatus()); choiceTypeBuilder.setParentTypeForBuilder(childOf); @@ -738,20 +740,24 @@ final class GenHelperUtil { annotateDeprecatedIfNecessary(choiceNode.getStatus(), choiceTypeBuilder); genCtx.get(module).addChildNodeType(choiceNode, choiceTypeBuilder); generateTypesFromChoiceCases(module, schemaContext, genCtx, basePackageName, choiceTypeBuilder.toInstance(), - choiceNode, verboseClasssComments, typeProvider, genTypeBuilders, namespaceType); + choiceNode, verboseClasssComments, typeProvider, genTypeBuilders, namespaceType); } private static void containerToGenType(final Module module, final String basePackageName, - final GeneratedTypeBuilder parent, final GeneratedTypeBuilder childOf, final ContainerSchemaNode node, - final SchemaContext schemaContext, final boolean verboseClassComments, final Map genCtx, - final Map> genTypeBuilders, final TypeProvider typeProvider, - final BindingNamespaceType namespaceType) { + final GeneratedTypeBuilder parent, final GeneratedTypeBuilder childOf, + final ContainerSchemaNode node, + final SchemaContext schemaContext, final boolean verboseClassComments, + final Map genCtx, + final Map> genTypeBuilders, + final TypeProvider typeProvider, + final BindingNamespaceType namespaceType) { final GeneratedTypeBuilder genType = processDataSchemaNode(module, basePackageName, childOf, node, schemaContext, verboseClassComments, genCtx, genTypeBuilders, typeProvider, namespaceType); if (genType != null) { StringBuilder getterName = new StringBuilder(node.getQName().getLocalName()); - constructGetter(parent, getterName.toString(), node.getDescription().orElse(null), genType, node.getStatus()); + constructGetter(parent, getterName.toString(), node.getDescription().orElse(null), genType, node + .getStatus()); resolveDataSchemaNodes(module, basePackageName, genType, genType, node.getChildNodes(), genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); processUsesImplements(node, module, schemaContext, genCtx, namespaceType); @@ -760,9 +766,10 @@ final class GenHelperUtil { private static void listToGenType(final Module module, final String basePackageName, final GeneratedTypeBuilder parent, final GeneratedTypeBuilder childOf, final ListSchemaNode node, final SchemaContext schemaContext, - final boolean verboseClassComments, final Map genCtx, - final Map> genTypeBuilders, final TypeProvider typeProvider, - final BindingNamespaceType namespaceType) { + final boolean verboseClassComments, final Map genCtx, + final Map> genTypeBuilders, final + TypeProvider typeProvider, + final BindingNamespaceType namespaceType) { final GeneratedTypeBuilder genType = processDataSchemaNode(module, basePackageName, childOf, node, schemaContext, verboseClassComments, genCtx, genTypeBuilders, typeProvider, namespaceType); @@ -772,7 +779,7 @@ final class GenHelperUtil { Type getterReturnType = Types.listTypeFor(genType); if (BindingNamespaceType.isGrouping(namespaceType)) { getterReturnType = Types.listTypeFor(wildcardTypeFor(genType.getPackageName(), genType.getName(), - true, true, null)); + true, true, null)); } constructGetter(parent, nodeName, node.getDescription().orElse(null), getterReturnType, node.getStatus()); @@ -781,11 +788,14 @@ final class GenHelperUtil { BindingNamespaceType.Key)).append('.').append(nodeName).toString(); //FIXME: Is it neccessary to generate interface of key and implemented by class? if (BindingNamespaceType.isGrouping(namespaceType)) { - final GeneratedTypeBuilder genTypeBuilder = resolveListKeyTypeBuilder(packageName, node, genCtx.get(module)); + final GeneratedTypeBuilder genTypeBuilder = resolveListKeyTypeBuilder(packageName, node, + genCtx.get(module)); for (final DataSchemaNode schemaNode : node.getChildNodes()) { if (resolveDataSchemaNodesCheck(module, schemaContext, schemaNode)) { - addSchemaNodeToListTypeBuilders(nodeName, basePackageName, schemaNode, genType, genTypeBuilder, listKeys, - module, typeProvider, schemaContext, genCtx, genTypeBuilders, verboseClassComments, namespaceType); + addSchemaNodeToListTypeBuilders(nodeName, basePackageName, schemaNode, genType, + genTypeBuilder, listKeys, + module, typeProvider, schemaContext, genCtx, genTypeBuilders, verboseClassComments, + namespaceType); } } if (genTypeBuilder != null) { @@ -801,14 +811,16 @@ final class GenHelperUtil { genType.addImplementsType(identifiableMarker); if (BindingNamespaceType.isData(namespaceType)) { genType.addImplementsType(parameterizedTypeFor(BindingTypes.TREE_CHILD_NODE, childOf, - parameterizedTypeFor(BindingTypes.IDENTIFIABLE_ITEM, genType, genTOBuilder))); + parameterizedTypeFor(BindingTypes.IDENTIFIABLE_ITEM, genType, genTOBuilder))); } } for (final DataSchemaNode schemaNode : node.getChildNodes()) { if (resolveDataSchemaNodesCheck(module, schemaContext, schemaNode)) { - addSchemaNodeToListBuilders(nodeName, basePackageName, schemaNode, genType, genTOBuilder, listKeys, - module, typeProvider, schemaContext, genCtx, genTypeBuilders, verboseClassComments, namespaceType); + addSchemaNodeToListBuilders(nodeName, basePackageName, schemaNode, genType, genTOBuilder, + listKeys, + module, typeProvider, schemaContext, genCtx, genTypeBuilders, verboseClassComments, + namespaceType); } } processUsesImplements(node, module, schemaContext, genCtx, namespaceType); @@ -826,8 +838,8 @@ final class GenHelperUtil { } private static void typeBuildersToGenTypes(final Module module, final GeneratedTypeBuilder typeBuilder, - final Type keyType, final Map genCtx, - final BindingNamespaceType namespaceType) { + final Type keyType, final Map genCtx, + final BindingNamespaceType namespaceType) { checkArgument(typeBuilder != null, "Generated Type Builder cannot be NULL."); if (keyType != null) { Type returnKeyType = keyType; @@ -835,19 +847,20 @@ final class GenHelperUtil { returnKeyType = wildcardTypeFor(keyType.getPackageName(), keyType.getName(), true, true, null); } - constructGetter(typeBuilder, "identifier", "Returns Primary Key of Yang List Type", returnKeyType, Status.CURRENT); + constructGetter(typeBuilder, "identifier", "Returns Primary Key of Yang List Type", returnKeyType, Status + .CURRENT); } } private static void addPatternConstant(final GeneratedTypeBuilder typeBuilder, final String leafName, - final List patternConstraints) { + final List patternConstraints) { if (!patternConstraints.isEmpty()) { final StringBuilder field = new StringBuilder(); field.append(BindingMapping.PATTERN_CONSTANT_NAME).append("_") - .append(JavaIdentifierNormalizer.normalizeSpecificIdentifier(leafName, JavaIdentifier.METHOD)); + .append(JavaIdentifierNormalizer.normalizeSpecificIdentifier(leafName, JavaIdentifier.METHOD)); typeBuilder.addConstant(Types.listTypeFor(BaseYangTypes.STRING_TYPE), field.toString(), - resolveRegExpressions(patternConstraints)); + resolveRegExpressions(patternConstraints)); } } @@ -855,24 +868,23 @@ final class GenHelperUtil { * Converts leaf to the getter method which is added to * typeBuilder. * - * @param typeBuilder - * generated type builder to which is added getter method as - * leaf mapping - * @param leaf - * leaf schema node which is mapped as getter method which is - * added to typeBuilder - * @param module - * Module in which type was defined + * @param typeBuilder generated type builder to which is added getter method as + * leaf mapping + * @param leaf leaf schema node which is mapped as getter method which is + * added to typeBuilder + * @param module Module in which type was defined * @return boolean value - *
    - *
  • false - if leaf or typeBuilder are - * null
  • - *
  • true - in other cases
  • - *
+ *
    + *
  • false - if leaf or typeBuilder are + * null
  • + *
  • true - in other cases
  • + *
*/ private static Type resolveLeafSchemaNodeAsMethod(final String nodeName, final SchemaContext schemaContext, - final GeneratedTypeBuilder typeBuilder, final Map genCtx, final LeafSchemaNode leaf, - final Module module, final TypeProvider typeProvider, final boolean verboseClassComments) { + final GeneratedTypeBuilder typeBuilder, final Map genCtx, final LeafSchemaNode leaf, + final Module module, final TypeProvider typeProvider, final + boolean verboseClassComments) { if (leaf == null || typeBuilder == null) { return null; } @@ -896,12 +908,15 @@ final class GenHelperUtil { } else { if (typeDef.getBaseType() == null && (typeDef instanceof EnumTypeDefinition || typeDef instanceof UnionTypeDefinition || typeDef instanceof BitsTypeDefinition)) { - LeafSchemaNode originalLeaf = (LeafSchemaNode) ((DerivableSchemaNode) leaf).getOriginal().orElse(null); + LeafSchemaNode originalLeaf = (LeafSchemaNode) ((DerivableSchemaNode) leaf).getOriginal() + .orElse(null); Preconditions.checkNotNull(originalLeaf); - returnType = genCtx.get(findParentModule(schemaContext, originalLeaf)).getInnerType(typeDef.getPath()); + returnType = genCtx.get(findParentModule(schemaContext, originalLeaf)).getInnerType(typeDef + .getPath()); } else { final Restrictions restrictions = BindingGeneratorUtil.getRestrictions(typeDef); - returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf, restrictions, genCtx.get(module)); + returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf, restrictions, + genCtx.get(module)); } } } else if (isInnerType(leaf, typeDef)) { @@ -920,7 +935,7 @@ final class GenHelperUtil { if (genTOBuilder != null) { //TODO: https://bugs.opendaylight.org/show_bug.cgi?id=2289 returnType = createReturnTypeForUnion(genTOBuilder, typeDef, typeBuilder, parentModule, - typeProvider, verboseClassComments); + typeProvider, verboseClassComments); } } else if (typeDef instanceof BitsTypeDefinition) { final GeneratedTOBuilder genTOBuilder = addTOToTypeBuilder(typeDef, typeBuilder, leaf, parentModule, @@ -955,7 +970,7 @@ final class GenHelperUtil { final String leafGetterName; if ("key".equals(leafName.toLowerCase())) { StringBuilder sb = new StringBuilder(leafName) - .append('_').append("RESERVED_WORD"); + .append('_').append("RESERVED_WORD"); leafGetterName = sb.toString(); } else { leafGetterName = leafName; @@ -968,25 +983,24 @@ final class GenHelperUtil { * Converts node leaf list schema node to getter method of * typeBuilder. * - * @param typeBuilder - * generated type builder to which is node added as - * getter method - * @param node - * leaf list schema node which is added to - * typeBuilder as getter method - * @param module module + * @param typeBuilder generated type builder to which is node added as + * getter method + * @param node leaf list schema node which is added to + * typeBuilder as getter method + * @param module module * @param typeProvider type provider instance - * @param genCtx actual generated context + * @param genCtx actual generated context * @return boolean value - *
    - *
  • true - if node, typeBuilder, - * nodeName equal null or node is added by uses
  • - *
  • false - other cases
  • - *
+ *
    + *
  • true - if node, typeBuilder, + * nodeName equal null or node is added by uses
  • + *
  • false - other cases
  • + *
*/ private static boolean resolveLeafListSchemaNode(final SchemaContext schemaContext, final GeneratedTypeBuilder typeBuilder, final LeafListSchemaNode node, final Module module, final TypeProvider typeProvider, - final Map genCtx, final boolean verboseClassComments) { + final Map genCtx, final boolean + verboseClassComments) { if (node == null || typeBuilder == null) { return false; } @@ -1011,7 +1025,7 @@ final class GenHelperUtil { typeProvider, schemaContext, genCtx.get(module), genCtx); if (genTOBuilder != null) { returnType = createReturnTypeForUnion(genTOBuilder, typeDef, typeBuilder, parentModule, - typeProvider, verboseClassComments); + typeProvider, verboseClassComments); } } else if (typeDef instanceof BitsTypeDefinition) { final GeneratedTOBuilder genTOBuilder = addTOToTypeBuilder(typeDef, typeBuilder, node, parentModule, @@ -1019,7 +1033,8 @@ final class GenHelperUtil { returnType = genTOBuilder.toInstance(); } else { final Restrictions restrictions = BindingGeneratorUtil.getRestrictions(typeDef); - returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, node, restrictions, genCtx.get(module)); + returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, node, restrictions, + genCtx.get(module)); addPatternConstant(typeBuilder, nodeName.getLocalName(), restrictions.getPatternConstraints()); } @@ -1031,7 +1046,8 @@ final class GenHelperUtil { } final ParameterizedType listType = Types.listTypeFor(returnType); - constructGetter(typeBuilder, nodeName.getLocalName(), node.getDescription().orElse(null), listType, node.getStatus()); + constructGetter(typeBuilder, nodeName.getLocalName(), node.getDescription().orElse(null), listType, node + .getStatus()); return true; } @@ -1039,6 +1055,7 @@ final class GenHelperUtil { * Converts caseNodes set to list of corresponding generated * types. * + *

* For every case which isn't added through augment or uses is * created generated type builder. The package names for the builder is * created as concatenation of the module package ( @@ -1046,32 +1063,27 @@ final class GenHelperUtil { * concrete case. There is also relation "implements type" * between every case builder and choice type * - * @param module - * current module - * @param schemaContext - * current schema context - * @param genCtx - * actual generated context - * @param basePackageName - * string with the module package name - * @param refChoiceType - * type which represents superior case - * @param choiceNode - * choice case node which is mapped to generated type - * @param verboseClassComments - * Javadoc verbosity switch - * @throws IllegalArgumentException - *

    - *
  • if basePackageName equals null
  • - *
  • if refChoiceType equals null
  • - *
  • if caseNodes equals null
  • - *
+ * @param module current module + * @param schemaContext current schema context + * @param genCtx actual generated context + * @param basePackageName string with the module package name + * @param refChoiceType type which represents superior case + * @param choiceNode choice case node which is mapped to generated type + * @param verboseClassComments Javadoc verbosity switch + * @throws IllegalArgumentException
    + *
  • if basePackageName equals null
  • + *
  • if refChoiceType equals null
  • + *
  • if caseNodes equals null
  • + *
*/ private static void generateTypesFromChoiceCases(final Module module, final SchemaContext schemaContext, - final Map genCtx, final String basePackageName, final GeneratedType refChoiceType, - final ChoiceSchemaNode choiceNode, final boolean verboseClassComments, - final TypeProvider typeProvider, final Map> genTypeBuilders, - final BindingNamespaceType namespaceType) { + final Map genCtx, final String + basePackageName, final GeneratedType refChoiceType, + final ChoiceSchemaNode choiceNode, final boolean + verboseClassComments, + final TypeProvider typeProvider, final Map> genTypeBuilders, + final BindingNamespaceType namespaceType) { checkArgument(basePackageName != null, "Base Package Name cannot be NULL."); checkArgument(refChoiceType != null, "Referenced Choice Type cannot be NULL."); checkArgument(choiceNode != null, "ChoiceNode cannot be NULL."); @@ -1079,8 +1091,8 @@ final class GenHelperUtil { for (final CaseSchemaNode caseNode : choiceNode.getCases().values()) { if (caseNode != null && resolveDataSchemaNodesCheck(module, schemaContext, caseNode)) { final GeneratedTypeBuilder caseTypeBuilder = addDefaultInterfaceDefinition(basePackageName, caseNode, - null, module, genCtx, schemaContext, verboseClassComments, - genTypeBuilders, typeProvider, namespaceType); + null, module, genCtx, schemaContext, verboseClassComments, + genTypeBuilders, typeProvider, namespaceType); caseTypeBuilder.addImplementsType(refChoiceType); caseTypeBuilder.setParentTypeForBuilder(refChoiceType.getParentTypeForBuilder()); annotateDeprecatedIfNecessary(caseNode.getStatus(), caseTypeBuilder); @@ -1091,7 +1103,7 @@ final class GenHelperUtil { resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, (GeneratedTypeBuilder) refChoiceType.getParentTypeForBuilder(), caseNode.getChildNodes(), - genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); + genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); processUsesImplements(caseNode, module, schemaContext, genCtx, namespaceType); } } @@ -1099,7 +1111,7 @@ final class GenHelperUtil { private static Type resolveAnyNodeAsMethod(final SchemaContext schemaContext, final GeneratedTypeBuilder typeBuilder, final Map genCtx, final DataSchemaNode node, final Module module, - final TypeProvider typeProvider) { + final TypeProvider typeProvider) { final String anyName = node.getQName().getLocalName(); if (anyName == null) { @@ -1115,44 +1127,35 @@ final class GenHelperUtil { * Adds schemaNode to typeBuilder as getter method * or to genTOBuilder as property. * - * @param nodeName - * string contains the name of list - * @param basePackageName - * string contains the module package name - * @param schemaNode - * data schema node which should be added as getter method to - * typeBuilder or as a property to - * genTOBuilder if is part of the list key - * @param typeBuilder - * generated type builder for the list schema node - * @param genTOBuilder - * generated TO builder for the list keys - * @param listKeys - * list of string which contains QNames of the list keys - * @param module - * current module - * @param typeProvider - * provider that defines contract for generated types - * @param schemaContext - * schema context - * @param genCtx - * map of generated entities in context of YANG modules - * @param genTypeBuilders - * map of generated type builders - * @param verboseClassComments - * generate verbose comments - * @throws IllegalArgumentException - *
    - *
  • if schemaNode equals null
  • - *
  • if typeBuilder equals null
  • - *
+ * @param nodeName string contains the name of list + * @param basePackageName string contains the module package name + * @param schemaNode data schema node which should be added as getter method to + * typeBuilder or as a property to + * genTOBuilder if is part of the list key + * @param typeBuilder generated type builder for the list schema node + * @param genTOBuilder generated TO builder for the list keys + * @param listKeys list of string which contains QNames of the list keys + * @param module current module + * @param typeProvider provider that defines contract for generated types + * @param schemaContext schema context + * @param genCtx map of generated entities in context of YANG modules + * @param genTypeBuilders map of generated type builders + * @param verboseClassComments generate verbose comments + * @throws IllegalArgumentException
    + *
  • if schemaNode equals null
  • + *
  • if typeBuilder equals null
  • + *
*/ private static void addSchemaNodeToListBuilders(final String nodeName, final String basePackageName, - final DataSchemaNode schemaNode, final GeneratedTypeBuilder typeBuilder, - final GeneratedTOBuilder genTOBuilder, final List listKeys, final Module module, - final TypeProvider typeProvider, final SchemaContext schemaContext, final Map genCtx, - final Map> genTypeBuilders, final boolean verboseClassComments, - final BindingNamespaceType namespaceType) { + final DataSchemaNode schemaNode, final GeneratedTypeBuilder + typeBuilder, + final GeneratedTOBuilder genTOBuilder, final List + listKeys, final Module module, + final TypeProvider typeProvider, final SchemaContext + schemaContext, final Map genCtx, + final Map> + genTypeBuilders, final boolean verboseClassComments, + final BindingNamespaceType namespaceType) { checkArgument(schemaNode != null, "Data Schema Node cannot be NULL."); checkArgument(typeBuilder != null, "Generated Type Builder cannot be NULL."); @@ -1164,8 +1167,9 @@ final class GenHelperUtil { typeProvider, verboseClassComments); if (listKeys.contains(leafQName)) { if (type == null) { - resolveLeafSchemaNodeAsProperty(nodeName, schemaContext, typeProvider, genCtx, genTOBuilder, leaf, true, - module); + resolveLeafSchemaNodeAsProperty(nodeName, schemaContext, typeProvider, genCtx, genTOBuilder, + leaf, true, + module); } else { AuxiliaryGenUtils.resolveLeafSchemaNodeAsProperty(nodeName, genTOBuilder, leaf, type, true); } @@ -1188,11 +1192,15 @@ final class GenHelperUtil { } private static void addSchemaNodeToListTypeBuilders(final String nodeName, final String basePackageName, - final DataSchemaNode schemaNode, final GeneratedTypeBuilder typeBuilder, - final GeneratedTypeBuilder genTypeBuilder, final List listKeys, final Module module, - final TypeProvider typeProvider, final SchemaContext schemaContext, final Map genCtx, - final Map> genTypeBuilders, final boolean verboseClassComments, - final BindingNamespaceType namespaceType) { + final DataSchemaNode schemaNode, final GeneratedTypeBuilder + typeBuilder, + final GeneratedTypeBuilder genTypeBuilder, final List + listKeys, final Module module, + final TypeProvider typeProvider, final SchemaContext + schemaContext, final Map genCtx, + final Map> + genTypeBuilders, final boolean verboseClassComments, + final BindingNamespaceType namespaceType) { checkArgument(schemaNode != null, "Data Schema Node cannot be NULL."); checkArgument(typeBuilder != null, "Generated Type Builder cannot be NULL."); @@ -1222,9 +1230,12 @@ final class GenHelperUtil { } } - private static boolean resolveLeafSchemaNodeAsProperty(final String nodeName, final SchemaContext schemaContext, final TypeProvider - typeProvider, final Map genCtx, final GeneratedTOBuilder - toBuilder, final LeafSchemaNode leaf, final boolean isReadOnly, final Module module) { + private static boolean resolveLeafSchemaNodeAsProperty(final String nodeName, final SchemaContext schemaContext, + final TypeProvider + typeProvider, final Map + genCtx, final GeneratedTOBuilder + toBuilder, final LeafSchemaNode leaf, final + boolean isReadOnly, final Module module) { if (leaf != null && toBuilder != null) { Type returnType; @@ -1240,7 +1251,7 @@ final class GenHelperUtil { // Annonymous enumeration (already generated, since it is inherited via uses). LeafSchemaNode originalLeaf = (LeafSchemaNode) SchemaNodeUtils.getRootOriginalIfPossible(leaf); QName qname = originalLeaf.getQName(); - final Module enumModule = schemaContext.findModule(qname.getModule()).orElse(null); + final Module enumModule = schemaContext.findModule(qname.getModule()).orElse(null); returnType = genCtx.get(enumModule).getInnerType(originalLeaf.getType().getPath()); } else { returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf, genCtx.get(module)); @@ -1255,11 +1266,15 @@ final class GenHelperUtil { return baseType != null && baseType.getBaseType() != null ? baseType : typeDef; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) private static GeneratedTypeBuilder processDataSchemaNode(final Module module, final String basePackageName, - final GeneratedTypeBuilder childOf, final DataSchemaNode node, final SchemaContext schemaContext, - final boolean verboseClassComments, final Map genCtx, final Map> genTypeBuilders, final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { + final GeneratedTypeBuilder childOf, final + DataSchemaNode node, final SchemaContext + schemaContext, + final boolean verboseClassComments, final Map genCtx, final Map> genTypeBuilders, final TypeProvider typeProvider, final BindingNamespaceType + namespaceType) { final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(basePackageName, node, childOf, module, genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); @@ -1289,25 +1304,18 @@ final class GenHelperUtil { * saved at first positions. For every grouping the record is added to map * {@link ModuleContext#groupings allGroupings} * - * @param module - * current module - * @param groupings - * collection of groupings from which types will be generated - * @param typeProvider - * provider that defines contract for generated types - * @param schemaContext - * schema context - * @param genCtx - * map of generated entities in context of YANG modules - * @param genTypeBuilders - * map of generated type builders - * @param verboseClassComments - * generate verbose comments - * + * @param module current module + * @param groupings collection of groupings from which types will be generated + * @param typeProvider provider that defines contract for generated types + * @param schemaContext schema context + * @param genCtx map of generated entities in context of YANG modules + * @param genTypeBuilders map of generated type builders + * @param verboseClassComments generate verbose comments */ static Map groupingsToGenTypes(final Module module, final Collection groupings, Map genCtx, final SchemaContext schemaContext, final boolean - verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider) { + verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider) { final String basePackageName = BindingMapping.getRootPackageName(module); final List groupingsSortedByDependencies = new GroupingDefinitionDependencySort() .sort(groupings); @@ -1323,30 +1331,23 @@ final class GenHelperUtil { * builder is created and every child node of grouping is resolved to the * method. * - * @param basePackageName - * string contains the module package name - * @param grouping - * GroupingDefinition which contains data about grouping - * @param module - * current module - * @param typeProvider - * provider that defines contract for generated types - * @param schemaContext - * schema context - * @param genCtx - * map of generated entities in context of YANG modules - * @param genTypeBuilders - * map of generated type builders - * @param verboseClassComments - * generate verbose comments - * + * @param basePackageName string contains the module package name + * @param grouping GroupingDefinition which contains data about grouping + * @param module current module + * @param typeProvider provider that defines contract for generated types + * @param schemaContext schema context + * @param genCtx map of generated entities in context of YANG modules + * @param genTypeBuilders map of generated type builders + * @param verboseClassComments generate verbose comments * @return GeneratedType which is generated from grouping (object of type - * GroupingDefinition) + * GroupingDefinition) */ - private static Map groupingToGenType(final String basePackageName, final GroupingDefinition grouping, final Module - module, Map genCtx, final SchemaContext schemaContext, final boolean - verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider) { - final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(basePackageName, grouping, null, module, genCtx, + private static Map groupingToGenType(final String basePackageName, + final GroupingDefinition grouping, final Module module, Map genCtx, + final SchemaContext schemaContext, final boolean verboseClassComments, + final Map> genTypeBuilders, final TypeProvider typeProvider) { + final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(basePackageName, grouping, null, module, + genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, BindingNamespaceType.Grouping); annotateDeprecatedIfNecessary(grouping.getStatus(), genType); genCtx.get(module).addGroupingType(grouping, genType); @@ -1365,30 +1366,29 @@ final class GenHelperUtil { * class {@link org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode * BaseIdentity} is added * - * @param module - * current module - * @param basePackageName - * string contains the module package name - * @param identity - * IdentitySchemaNode which contains data about identity - * @param schemaContext - * SchemaContext which is used to get package and name - * information about base of identity - * @param genCtx generated context + * @param module current module + * @param basePackageName string contains the module package name + * @param identity IdentitySchemaNode which contains data about identity + * @param schemaContext SchemaContext which is used to get package and name + * information about base of identity + * @param genCtx generated context * @return returns generated context */ static Map identityToGenType(final Module module, final String basePackageName, - final IdentitySchemaNode identity, final SchemaContext schemaContext, final Map genCtx, - final boolean verboseClassComments) { + final IdentitySchemaNode identity, final SchemaContext + schemaContext, final Map genCtx, + final boolean verboseClassComments) { resolveIdentitySchemaNode(basePackageName, schemaContext, identity, module, verboseClassComments, genCtx); return genCtx; } - private static GeneratedTypeBuilder resolveIdentitySchemaNode(final String basePackageName, final SchemaContext schemaContext, - final IdentitySchemaNode identity, final Module module, final boolean verboseClassComments, - final Map genCtx) { - Preconditions.checkNotNull(identity,"Identity can not be null!"); + private static GeneratedTypeBuilder resolveIdentitySchemaNode(final String basePackageName, final SchemaContext + schemaContext, + final IdentitySchemaNode identity, final Module + module, final boolean verboseClassComments, + final Map genCtx) { + Preconditions.checkNotNull(identity, "Identity can not be null!"); //check first if identity has been resolved as base identity of some other one GeneratedTypeBuilder newType = findIdentityByQname(identity.getQName(), genCtx); @@ -1398,7 +1398,8 @@ final class GenHelperUtil { "If the type is null ,it must be in the same module, otherwise it must has been" + "resolved by an imported module."); - final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, identity.getPath(), + final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, identity + .getPath(), BindingNamespaceType.Identity); newType = new GeneratedTypeBuilderImpl(packageName, identity.getQName().getLocalName(), true, false, genCtx.get(module)); @@ -1406,14 +1407,15 @@ final class GenHelperUtil { final Set baseIdentities = identity.getBaseIdentities(); if (baseIdentities.size() == 0) { //no base - abstract - final GeneratedTypeBuilderImpl genType = new GeneratedTypeBuilderImpl(BaseIdentity.class.getPackage().getName(), + final GeneratedTypeBuilderImpl genType = new GeneratedTypeBuilderImpl(BaseIdentity.class.getPackage() + .getName(), BaseIdentity.class.getSimpleName(), genCtx.get(module)); newType.addImplementsType(genType.toInstance()); } else { //multiple bases - inheritance for (IdentitySchemaNode baseIdentity : baseIdentities) { GeneratedTypeBuilder baseType = resolveIdentitySchemaNode(basePackageName, schemaContext, - baseIdentity, module, verboseClassComments, genCtx); + baseIdentity, module, verboseClassComments, genCtx); newType.addImplementsType(baseType.toInstance()); } } diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/ModuleToGenType.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/ModuleToGenType.java index 991b6a51d6..3515c472de 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/ModuleToGenType.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/ModuleToGenType.java @@ -18,11 +18,13 @@ import static org.opendaylight.mdsal.binding.javav2.generator.util.BindingTypes. import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; + import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider; import org.opendaylight.mdsal.binding.javav2.generator.util.TypeComments; @@ -56,19 +58,23 @@ final class ModuleToGenType { genCtx = allTypeDefinitionsToGenTypes(module, genCtx, typeProvider); genCtx = groupingsToGenTypes(module, module.getGroupings(), genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider); - genCtx = allIdentitiesToGenTypes(module, schemaContext, genCtx, verboseClassComments, genTypeBuilders, typeProvider); + genCtx = allIdentitiesToGenTypes(module, schemaContext, genCtx, verboseClassComments, genTypeBuilders, + typeProvider); if (!module.getChildNodes().isEmpty()) { - final GeneratedTypeBuilder moduleType = GenHelperUtil.moduleToDataType(module, genCtx, verboseClassComments); + final GeneratedTypeBuilder moduleType = GenHelperUtil.moduleToDataType(module, genCtx, + verboseClassComments); genCtx.get(module).addModuleNode(moduleType); final String basePackageName = BindingMapping.getRootPackageName(module); GenHelperUtil.resolveDataSchemaNodes(module, basePackageName, moduleType, moduleType, module - .getChildNodes(), genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, + .getChildNodes(), genCtx, schemaContext, verboseClassComments, genTypeBuilders, + typeProvider, BindingNamespaceType.Data); processUsesImplements(module, module, schemaContext, genCtx, BindingNamespaceType.Data); } - genCtx = notificationsToGenType(module, genCtx, schemaContext, genTypeBuilders, verboseClassComments, typeProvider); + genCtx = notificationsToGenType(module, genCtx, schemaContext, genTypeBuilders, verboseClassComments, + typeProvider); //after potential parent data schema nodes genCtx = actionsAndRPCMethodsToGenType(module, genCtx, schemaContext, verboseClassComments, @@ -81,18 +87,16 @@ final class ModuleToGenType { * Converts all extended type definitions of module to the list of * Type objects. * - * @param module - * module from which is obtained set of type definitions - * @throws IllegalArgumentException - *
    - *
  • if module is null
  • - *
  • if name of module is null
  • - *
- * @throws IllegalStateException - * if set of type definitions from module is null + * @param module module from which is obtained set of type definitions + * @throws IllegalArgumentException
    + *
  • if module is null
  • + *
  • if name of module is null
  • + *
+ * @throws IllegalStateException if set of type definitions from module is null */ - private static Map allTypeDefinitionsToGenTypes(final Module module, final Map genCtx, - final TypeProvider typeProvider) { + private static Map allTypeDefinitionsToGenTypes(final Module module, final Map genCtx, + final TypeProvider typeProvider) { Preconditions.checkArgument(module != null, "Module reference cannot be NULL."); Preconditions.checkArgument(module.getName() != null, "Module name cannot be NULL."); final DataNodeIterator it = new DataNodeIterator(module); @@ -113,7 +117,10 @@ final class ModuleToGenType { private static Map actionsAndRPCMethodsToGenType(final Module module, Map genCtx, final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, final TypeProvider typeProvider) { + final Map> + genTypeBuilders, final + TypeProvider typeProvider) { genCtx = RpcActionGenHelper.rpcMethodsToGenType(module, genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider); @@ -127,19 +134,19 @@ final class ModuleToGenType { * Converts all identities of the module to the list of * Type objects. * - * @param module - * module from which is obtained set of all identity objects to - * iterate over them - * @param schemaContext - * schema context only used as input parameter for method - * {@link GenHelperUtil#identityToGenType(Module, String, IdentitySchemaNode, SchemaContext, Map, boolean)} - * @param genCtx generated context + * @param module module from which is obtained set of all identity objects to + * iterate over them + * @param schemaContext schema context only used as input parameter for method + * {@link GenHelperUtil#identityToGenType(Module, String, IdentitySchemaNode, SchemaContext,Map, boolean)} + * @param genCtx generated context * @return returns generated context - * */ private static Map allIdentitiesToGenTypes(final Module module, - final SchemaContext schemaContext, Map genCtx, boolean verboseClassComments, - final Map> genTypeBuilders, final TypeProvider typeProvider) { + final SchemaContext schemaContext, Map genCtx, boolean verboseClassComments, + final Map> genTypeBuilders, + final TypeProvider typeProvider) { final Set schemaIdentities = module.getIdentities(); final String basePackageName = BindingMapping.getRootPackageName(module); @@ -147,7 +154,7 @@ final class ModuleToGenType { if (schemaIdentities != null && !schemaIdentities.isEmpty()) { for (final IdentitySchemaNode identity : schemaIdentities) { GenHelperUtil.identityToGenType(module, basePackageName, identity, schemaContext, genCtx, - verboseClassComments); + verboseClassComments); } } @@ -159,20 +166,21 @@ final class ModuleToGenType { * Type objects. In addition are to this list added containers * and lists which are part of this notification. * - * @param module - * module from which is obtained set of all notification objects - * to iterate over them - * @throws IllegalArgumentException - *
    - *
  • if the module equals null
  • - *
  • if the name of module equals null
  • - *
- * @throws IllegalStateException - * if set of notifications from module is null + * @param module module from which is obtained set of all notification objects + * to iterate over them + * @throws IllegalArgumentException
    + *
  • if the module equals null
  • + *
  • if the name of module equals null
  • + *
+ * @throws IllegalStateException if set of notifications from module is null */ - private static Map notificationsToGenType(final Module module, final Map genCtx, - final SchemaContext schemaContext, final Map> genTypeBuilders, - final boolean verboseClassComments, final TypeProvider typeProvider) { + private static Map notificationsToGenType(final Module module, final Map genCtx, + final SchemaContext schemaContext, final + Map> + genTypeBuilders, + final boolean verboseClassComments, final + TypeProvider typeProvider) { checkArgument(module != null, "Module reference cannot be NULL."); checkArgument(module.getName() != null, "Module name cannot be NULL."); final Set notifications = module.getNotifications(); @@ -201,12 +209,13 @@ final class ModuleToGenType { if (potential instanceof NotificationNodeContainer) { tiedNotifications = ((NotificationNodeContainer) potential) .getNotifications(); - for (final NotificationDefinition tiedNotification: tiedNotifications) { + for (final NotificationDefinition tiedNotification : tiedNotifications) { if (tiedNotification != null) { resolveNotification(listenerInterface, potential.getQName().getLocalName(), basePackageName, tiedNotification, module, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, genCtx); - processUsesImplements(tiedNotification, module, schemaContext, genCtx, BindingNamespaceType.Notification); + processUsesImplements(tiedNotification, module, schemaContext, genCtx, BindingNamespaceType + .Notification); } } } @@ -215,14 +224,14 @@ final class ModuleToGenType { if (verboseClassComments) { if (tiedNotifications != null) { YangSourceDefinition.of(module, - ImmutableSet.builder().addAll(notifications).addAll(tiedNotifications) - .build()).ifPresent(listenerInterface::setYangSourceDefinition); + ImmutableSet.builder().addAll(notifications).addAll(tiedNotifications) + .build()).ifPresent(listenerInterface::setYangSourceDefinition); } else { YangSourceDefinition.of(module, notifications).ifPresent(listenerInterface::setYangSourceDefinition); } listenerInterface.addComment(TypeComments.javadoc( - "Interface for receiving the following YANG notifications defined in module " + module.getName() - + "").get()); + "Interface for receiving the following YANG notifications defined in module " + module.getName() + + "").get()); } genCtx.get(module).addTopLevelNodeType(listenerInterface); diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelper.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelper.java index 5bcb0e8a4a..edc5560cf5 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelper.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelper.java @@ -36,10 +36,12 @@ import static org.opendaylight.mdsal.binding.javav2.generator.util.Types.paramet import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; + import java.util.Collection; import java.util.Map; import java.util.Optional; import java.util.Set; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider; import org.opendaylight.mdsal.binding.javav2.generator.util.BindingTypes; @@ -83,6 +85,7 @@ final class RpcActionGenHelper { * 1. routed RPC * 2. global RPC * + *

* In 1st case, we need Binding Generator behave like YANG 1.1 Action * * @param schemaNode RPC input node @@ -99,13 +102,14 @@ final class RpcActionGenHelper { } private static void resolveActions(final DataNodeContainer parent, final Module module, - final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, final Map genCtx, - final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { + final SchemaContext schemaContext, final boolean verboseClassComments, + final Map> genTypeBuilders, final + Map genCtx, + final TypeProvider typeProvider, final BindingNamespaceType namespaceType) { Preconditions.checkNotNull(parent, "Parent should not be NULL."); final Collection potentials = parent.getChildNodes(); for (DataSchemaNode potential : potentials) { - if (resolveDataSchemaNodesCheck(module, schemaContext,potential)) { + if (resolveDataSchemaNodesCheck(module, schemaContext, potential)) { BindingNamespaceType namespaceType1 = namespaceType; if (BindingNamespaceType.isData(namespaceType)) { if (potential instanceof GroupingDefinition) { @@ -117,8 +121,8 @@ final class RpcActionGenHelper { final Set actions = ((ActionNodeContainer) potential).getActions(); for (ActionDefinition action : actions) { final GeneratedTypeBuilder typeBuilder = resolveOperation(potential, action, module, - schemaContext, verboseClassComments, genTypeBuilders, genCtx, typeProvider, true, - namespaceType1); + schemaContext, verboseClassComments, genTypeBuilders, genCtx, typeProvider, true, + namespaceType1); genCtx.get(module).addTopLevelNodeType(typeBuilder); genCtx.get(module).addTypeToSchema(typeBuilder, action); } @@ -126,7 +130,7 @@ final class RpcActionGenHelper { if (potential instanceof DataNodeContainer) { resolveActions((DataNodeContainer) potential, module, schemaContext, verboseClassComments, - genTypeBuilders, genCtx, typeProvider, namespaceType1); + genTypeBuilders, genCtx, typeProvider, namespaceType1); } } } @@ -134,19 +138,23 @@ final class RpcActionGenHelper { /** * Converts Yang 1.1 Actions to list of Type objects. - * @param module module from which is obtained set of all Action objects to - * iterate over them - * @param genCtx input, generated context + * + * @param module module from which is obtained set of all Action objects to + * iterate over them + * @param genCtx input, generated context * @param verboseClassComments verbosity switch * @return generated context */ - static Map actionMethodsToGenType(final Module module, final Map genCtx, - final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, final TypeProvider typeProvider) { + static Map actionMethodsToGenType(final Module module, final Map + genCtx, + final SchemaContext schemaContext, final boolean + verboseClassComments, + final Map> + genTypeBuilders, final TypeProvider typeProvider) { checkModuleAndModuleName(module); resolveActions(module, module, schemaContext, verboseClassComments, genTypeBuilders, genCtx, typeProvider, - BindingNamespaceType.Operation); + BindingNamespaceType.Operation); return genCtx; } @@ -156,25 +164,21 @@ final class RpcActionGenHelper { * and lists which belong to input or output are also part of returning list. * Detected routed RPCs are turned to Yang 1.1 Actions * - * @param module - * module from which is obtained set of all RPC objects to - * iterate over them - * @param genCtx input, generated context + * @param module module from which is obtained set of all RPC objects to + * iterate over them + * @param genCtx input, generated context * @param verboseClassComments verbosity switch - * - * @throws IllegalArgumentException - *

    - *
  • if the module is null
  • - *
  • if the name of module is null
  • - *
- * @throws IllegalStateException - * if set of RPCs from module is null - * * @return generated context + * @throws IllegalArgumentException
    + *
  • if the module is null
  • + *
  • if the name of module is null
  • + *
+ * @throws IllegalStateException if set of RPCs from module is null */ - static Map rpcMethodsToGenType(final Module module, final Map genCtx, - final SchemaContext schemaContext, final boolean verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider) { + static Map rpcMethodsToGenType(final Module module, final Map genCtx, + final SchemaContext schemaContext, final boolean + verboseClassComments, final Map> genTypeBuilders, final TypeProvider typeProvider) { checkModuleAndModuleName(module); final Set rpcDefinitions = module.getRpcs(); @@ -185,8 +189,8 @@ final class RpcActionGenHelper { for (final RpcDefinition rpc : rpcDefinitions) { final GeneratedTypeBuilder typeBuilder = resolveOperation(null, rpc, module, schemaContext, - verboseClassComments, genTypeBuilders, genCtx, typeProvider, false, - BindingNamespaceType.Operation); + verboseClassComments, genTypeBuilders, genCtx, typeProvider, false, + BindingNamespaceType.Operation); genCtx.get(module).addTopLevelNodeType(typeBuilder); genCtx.get(module).addTypeToSchema(typeBuilder, rpc); } @@ -195,13 +199,19 @@ final class RpcActionGenHelper { } /** - * Converts RPC, Action or routed RPC into generated type + * Converts RPC, Action or routed RPC into generated type. + * * @return generated type */ - private static GeneratedTypeBuilder resolveOperation(final DataSchemaNode parent, final OperationDefinition operation, - final Module module, final SchemaContext schemaContext, final boolean verboseClassComments, - final Map> genTypeBuilders, final Map genCtx, - final TypeProvider typeProvider, final boolean isAction, final BindingNamespaceType namespaceType) { + private static GeneratedTypeBuilder resolveOperation(final DataSchemaNode parent, final OperationDefinition + operation, + final Module module, final SchemaContext schemaContext, + final boolean verboseClassComments, + final Map> + genTypeBuilders, final Map + genCtx, + final TypeProvider typeProvider, final boolean isAction, + final BindingNamespaceType namespaceType) { //operation name final String operationName = operation.getQName().getLocalName(); @@ -219,8 +229,8 @@ final class RpcActionGenHelper { if (verboseClassComments) { interfaceBuilder.addComment(TypeComments.javadoc( - "Interface for implementing the following YANG Operation defined in module " + module.getName() + "") - .get()); + "Interface for implementing the following YANG Operation defined in module " + + module.getName() + "").get()); YangSourceDefinition.of(module, operation).ifPresent(interfaceBuilder::setYangSourceDefinition); } @@ -266,14 +276,14 @@ final class RpcActionGenHelper { } operationMethod.addParameter(parameterizedTypeFor(KEYED_INSTANCE_IDENTIFIER, parentType, keyType), - "kii"); + "kii"); interfaceBuilder.addImplementsType(parameterizedTypeFor(LIST_ACTION, parentType, keyType, inType, - outType)); + outType)); } else { //Action operationMethod.addParameter(parameterizedTypeFor(INSTANCE_IDENTIFIER, parentType), "ii"); interfaceBuilder.addImplementsType(parameterizedTypeFor(ACTION, parentType, - parameterizedTypeFor(INSTANCE_IDENTIFIER, parentType) ,inType, outType)); + parameterizedTypeFor(INSTANCE_IDENTIFIER, parentType), inType, outType)); } } else { //RPC @@ -289,17 +299,17 @@ final class RpcActionGenHelper { return interfaceBuilder; } - private static GeneratedTypeBuilder resolveOperationNode(final GeneratedTypeBuilder parent, final Module module, final - ContainerSchemaNode operationNode, final String basePackageName, final SchemaContext schemaContext, final String - operationName, final boolean verboseClassComments, final TypeProvider typeProvider, final Map> genTypeBuilders, final Map genCtx, final boolean isInput, - final BindingNamespaceType namespaceType) { + private static GeneratedTypeBuilder resolveOperationNode(final GeneratedTypeBuilder parent, final Module module, + final ContainerSchemaNode operationNode, final String basePackageName, final SchemaContext schemaContext, + final String operationName, final boolean verboseClassComments, final TypeProvider typeProvider, + final Map> genTypeBuilders, + final Map genCtx, final boolean isInput, final BindingNamespaceType namespaceType) { final GeneratedTypeBuilder nodeType = addRawInterfaceDefinition(basePackageName, operationNode, schemaContext, operationName, "", verboseClassComments, genTypeBuilders, namespaceType, genCtx.get(module)); addImplementedInterfaceFromUses(operationNode, nodeType, genCtx); - nodeType.addImplementsType(parameterizedTypeFor(BindingTypes.TREE_CHILD_NODE, parent, parameterizedTypeFor - (BindingTypes.ITEM, nodeType))); + nodeType.addImplementsType(parameterizedTypeFor(BindingTypes.TREE_CHILD_NODE, parent, + parameterizedTypeFor(BindingTypes.ITEM, nodeType))); if (isInput) { nodeType.addImplementsType(parameterizedTypeFor(INPUT, nodeType)); @@ -308,8 +318,8 @@ final class RpcActionGenHelper { } nodeType.addImplementsType(parameterizedTypeFor(INSTANTIABLE, nodeType)); nodeType.addImplementsType(augmentable(nodeType)); - GenHelperUtil.resolveDataSchemaNodes(module, basePackageName, nodeType, nodeType, operationNode.getChildNodes(), genCtx, - schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); + GenHelperUtil.resolveDataSchemaNodes(module, basePackageName, nodeType, nodeType, operationNode.getChildNodes(), + genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType); final MethodSignatureBuilder nodeMethod = nodeType.addMethod("implementedInterface"); nodeMethod.setReturnType(parameterizedTypeFor(CLASS, nodeType)); diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/BaseYangTypes.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/BaseYangTypes.java index 058a90ee51..d0b0bf0919 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/BaseYangTypes.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/BaseYangTypes.java @@ -39,83 +39,83 @@ public final class BaseYangTypes { private static final Map TYPE_MAP; /** - * Type representation of binary YANG type + * Type representation of binary YANG type. */ public static final Type BINARY_TYPE = Types.primitiveType("byte[]", null); /** - * Type representation of boolean YANG type + * Type representation of boolean YANG type. */ public static final Type BOOLEAN_TYPE = Types.typeForClass(Boolean.class); /** - * Type representation of decimal64 YANG type + * Type representation of decimal64 YANG type. */ public static final Type DECIMAL64_TYPE = Types.typeForClass(BigDecimal.class); /** - * Type representation of empty YANG type + * Type representation of empty YANG type. */ public static final Type EMPTY_TYPE = Types.typeForClass(Empty.class); /** - * Type representation of enumeration YANG type + * Type representation of enumeration YANG type. */ public static final Type ENUM_TYPE = Types.typeForClass(Enum.class); /** - * Type representation of instance-identifier YANG type + * Type representation of instance-identifier YANG type. */ public static final Type INSTANCE_IDENTIFIER = Types.parameterizedTypeFor(Types .typeForClass(InstanceIdentifier.class)); /** - * Type representation of int8 YANG type + * Type representation of int8 YANG type. */ public static final Type INT8_TYPE = Types.typeForClass(Byte.class); /** - * Type representation of int16 YANG type + * Type representation of int16 YANG type. */ public static final Type INT16_TYPE = Types.typeForClass(Short.class); /** - * Type representation of int32 YANG type + * Type representation of int32 YANG type. */ public static final Type INT32_TYPE = Types.typeForClass(Integer.class); /** - * Type representation of int64 YANG type + * Type representation of int64 YANG type. */ public static final Type INT64_TYPE = Types.typeForClass(Long.class); /** - * Type representation of string YANG type + * Type representation of string YANG type. */ public static final Type STRING_TYPE = Types.typeForClass(String.class); /** - * Type representation of uint8 YANG type + * Type representation of uint8 YANG type. */ public static final Type UINT8_TYPE = Types.typeForClass(Uint8.class); /** - * Type representation of uint16 YANG type + * Type representation of uint16 YANG type. */ public static final Type UINT16_TYPE = Types.typeForClass(Uint16.class); /** - * Type representation of uint32 YANG type + * Type representation of uint32 YANG type. */ public static final Type UINT32_TYPE = Types.typeForClass(Uint32.class); /** - * Type representation of uint64 YANG type + * Type representation of uint64 YANG type. */ public static final Type UINT64_TYPE = Types.typeForClass(Uint64.class); /** - * Type representation of union YANG type + * Type representation of union YANG type. */ public static final Type UNION_TYPE = new UnionType(); @@ -231,10 +231,12 @@ public final class BaseYangTypes { public String getPackageName() { return BindingMapping.PACKAGE_PREFIX; } + @Override public String getName() { return "Union"; } + @Override public String getFullyQualifiedName() { return "Union"; diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/GroupingDefinitionDependencySort.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/GroupingDefinitionDependencySort.java index 6249b42bb5..4731486c2c 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/GroupingDefinitionDependencySort.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/GroupingDefinitionDependencySort.java @@ -32,6 +32,7 @@ public class GroupingDefinitionDependencySort { /** * Sorts set groupingDefinitions according to the mutual dependencies.
* + *

* Elements of groupingDefinitions are firstly transformed to {@link Node} interfaces and then are * sorted by {@link TopologicalSort#sort(Set)} method. *
@@ -72,6 +73,7 @@ public class GroupingDefinitionDependencySort { * Wraps every grouping definition to node type and adds to every node * information about dependencies. * + *

* The map with mapping from schema path (represents grouping definition) to * node is created. For every created node (next nodeFrom) is for its * wrapped grouping definition passed the set of its uses nodes diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/NodeWrappedType.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/NodeWrappedType.java index 53d359d09d..38f67ffa37 100644 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/NodeWrappedType.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/NodeWrappedType.java @@ -11,7 +11,7 @@ import org.opendaylight.yangtools.util.TopologicalSort.NodeImpl; public final class NodeWrappedType extends NodeImpl { /** - * The payload which is saved inside Node + * The payload which is saved inside Node. */ private final Object wrappedType; @@ -26,7 +26,7 @@ public final class NodeWrappedType extends NodeImpl { } /** - * Gets payload from class + * Gets payload from class. * * @return object with wrappedType */ @@ -35,14 +35,14 @@ public final class NodeWrappedType extends NodeImpl { } @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object object) { + if (this == object) { return true; } - if (!(o instanceof NodeWrappedType)) { + if (!(object instanceof NodeWrappedType)) { return false; } - NodeWrappedType nodeWrappedType = (NodeWrappedType) o; + NodeWrappedType nodeWrappedType = (NodeWrappedType) object; if (!wrappedType.equals(nodeWrappedType.wrappedType)) { return false; } diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeGenHelper.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeGenHelper.java index 9eb1bdcf28..f4a4a36ea6 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeGenHelper.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeGenHelper.java @@ -16,6 +16,7 @@ import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; + import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -24,6 +25,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.TreeMap; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.util.BindingGeneratorUtil; import org.opendaylight.mdsal.binding.javav2.generator.util.Types; @@ -65,7 +67,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Auxiliary util class for {@link TypeProviderImpl} class + * Auxiliary util class for {@link TypeProviderImpl} class. */ @Beta public final class TypeGenHelper { @@ -79,11 +81,9 @@ public final class TypeGenHelper { * Gets base type definition for extendTypeDef. The method is * recursively called until non ExtendedType type is found. * - * @param extendTypeDef - * type definition for which is the base type definition sought + * @param extendTypeDef type definition for which is the base type definition sought * @return type definition which is base type for extendTypeDef - * @throws IllegalArgumentException - * if extendTypeDef equal null + * @throws IllegalArgumentException if extendTypeDef equal null */ static TypeDefinition baseTypeDefForExtendedType(final TypeDefinition extendTypeDef) { Preconditions.checkArgument(extendTypeDef != null, "Type Definition reference cannot be NULL!"); @@ -102,31 +102,28 @@ public final class TypeGenHelper { * 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 typedef - * Type Definition - * @param innerExtendedType - * extended type which is part of some other extended type - * @param basePackageName - * string with the package name of the module - * @param moduleName - * Module Name + * @param typedef Type Definition + * @param innerExtendedType extended type which is part of some other extended type + * @param basePackageName string with the package name of the module + * @param moduleName Module Name * @return generated TO which extends generated TO for - * innerExtendedType - * @throws IllegalArgumentException - *

    - *
  • if extendedType equals null
  • - *
  • if basePackageName equals null
  • - *
  • if typedefName equals null
  • - *
+ * innerExtendedType + * @throws IllegalArgumentException
    + *
  • if extendedType equals null
  • + *
  • if basePackageName equals null
  • + *
  • if typedefName equals null
  • + *
*/ - @SuppressWarnings({ "rawtypes", "unchecked" }) - static GeneratedTransferObject provideGeneratedTOFromExtendedType(final TypeDefinition typedef, final - TypeDefinition innerExtendedType, final String basePackageName, final String moduleName, final SchemaContext - schemaContext, final Map, Map>> genTypeDefsContextMap, + @SuppressWarnings({"rawtypes", "unchecked"}) + static GeneratedTransferObject provideGeneratedTOFromExtendedType(final TypeDefinition typedef, + final TypeDefinition innerExtendedType, final String basePackageName, final String moduleName, + final SchemaContext schemaContext, + final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { Preconditions.checkArgument(innerExtendedType != null, "Extended type cannot be NULL!"); @@ -175,16 +172,14 @@ public final class TypeGenHelper { /** * Wraps base YANG type to generated TO. * - * @param basePackageName - * string with name of package to which the module belongs - * @param typedef - * type definition which is converted to the TO - * @param javaType - * JAVA Type to which is typedef mapped + * @param basePackageName string with name of package to which the module belongs + * @param typedef type definition which is converted to the TO + * @param javaType JAVA Type to which is typedef mapped * @return generated transfer object which representjavaType */ static GeneratedTransferObject wrapJavaTypeIntoTO(final String basePackageName, final TypeDefinition typedef, - final Type javaType, final String moduleName, final ModuleContext context) { + final Type javaType, final String moduleName, final + ModuleContext context) { Preconditions.checkNotNull(javaType, "javaType cannot be null"); final String propertyName = "value"; @@ -211,12 +206,9 @@ public final class TypeGenHelper { * 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 + * @param typedef extended type in which are the pattern constraints sought * @return map of strings which represents the constraint patterns - * @throws IllegalArgumentException - * if typedef equals null - * + * @throws IllegalArgumentException if typedef equals null */ static Map resolveRegExpressionsFromTypedef(final TypeDefinition typedef) { if (!(typedef instanceof StringTypeDefinition)) { @@ -231,8 +223,7 @@ public final class TypeGenHelper { * Converts the pattern constraints to the list of * the strings which represents these constraints. * - * @param patternConstraints - * list of pattern constraints + * @param patternConstraints list of pattern constraints * @return list of strings which represents the constraint patterns */ public static Map resolveRegExpressions(final List patternConstraints) { @@ -274,11 +265,10 @@ public final class TypeGenHelper { * 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 + * @param unsortedTypeDefinitions list of type definitions which should be sorted by depth * @return list of type definitions sorted according their each other - * dependencies (type definitions which are depend on other type - * definitions are in list behind them). + * dependencies (type definitions which are depend on other type + * definitions are in list behind them). */ static List> sortTypeDefinitionAccordingDepth( final Collection> unsortedTypeDefinitions) { @@ -287,7 +277,8 @@ public final class TypeGenHelper { final Map>> typeDefinitionsDepths = new TreeMap<>(); for (TypeDefinition unsortedTypeDefinition : unsortedTypeDefinitions) { final int depth = getTypeDefinitionDepth(unsortedTypeDefinition); - final List> typeDefinitionsConcreteDepth = typeDefinitionsDepths.computeIfAbsent(depth, k -> new ArrayList<>()); + final List> typeDefinitionsConcreteDepth = typeDefinitionsDepths.computeIfAbsent(depth, + k -> new ArrayList<>()); typeDefinitionsConcreteDepth.add(unsortedTypeDefinition); } @@ -298,20 +289,17 @@ public final class TypeGenHelper { } /** - * * Adds to the genTOBuilder the constant which contains regular - * expressions from the regularExpressions + * expressions from the regularExpressions. * - * @param genTOBuilder - * generated TO builder to which are - * regular expressions added - * @param expressions - * list of string which represent regular expressions + * @param genTOBuilder generated TO builder to which are + * regular expressions added + * @param expressions list of string which represent regular expressions */ static void addStringRegExAsConstant(final GeneratedTOBuilder genTOBuilder, final Map expressions) { if (!expressions.isEmpty()) { genTOBuilder.addConstant(Types.listTypeFor(BaseYangTypes.STRING_TYPE), BindingMapping.PATTERN_CONSTANT_NAME, - ImmutableMap.copyOf(expressions)); + ImmutableMap.copyOf(expressions)); } } @@ -319,10 +307,9 @@ public final class TypeGenHelper { * 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. + * @param typeDefinition type definition for which is depth sought. * @return number of immersions which are necessary to get from the type - * definition to the base type + * definition to the base type */ private static int getTypeDefinitionDepth(final TypeDefinition typeDefinition) { if (typeDefinition == null) { @@ -379,7 +366,7 @@ public final class TypeGenHelper { for (DataSchemaNode potential : potentials) { if (potential instanceof ActionNodeContainer) { final Set actions = ((ActionNodeContainer) potential).getActions(); - for (ActionDefinition action: actions) { + for (ActionDefinition action : actions) { final ContainerSchemaNode input = action.getInput(); if (input != null) { fillRecursively(ret, input); @@ -425,8 +412,7 @@ public final class TypeGenHelper { * Add {@link Serializable} to implemented interfaces of this TO. Also * compute and add serialVersionUID property. * - * @param gto - * transfer object which needs to be serializable + * @param gto transfer object which needs to be serializable */ static void makeSerializable(final GeneratedTOBuilderImpl gto) { gto.addImplementsType(Types.typeForClass(Serializable.class)); @@ -440,23 +426,21 @@ public final class TypeGenHelper { * {@link Enumeration * enumeration}. * - * @param enumTypeDef - * enumeration type definition which is converted to enumeration - * @param enumName - * string with name which is used as the enumeration name + * @param enumTypeDef enumeration type definition which is converted to enumeration + * @param enumName string with name which is used as the enumeration name * @return enumeration type which is built with data (name, enum values) - * from enumTypeDef - * @throws IllegalArgumentException - *
    - *
  • if enumTypeDef equals null
  • - *
  • if enum values of enumTypeDef equal null
  • - *
  • if Q name of enumTypeDef equal null
  • - *
  • if name of enumTypeDef equal null
  • - *
+ * from enumTypeDef + * @throws IllegalArgumentException
    + *
  • if enumTypeDef equals null
  • + *
  • if enum values of enumTypeDef equal null
  • + *
  • if Q name of enumTypeDef equal null
  • + *
  • if name of enumTypeDef equal null
  • + *
*/ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) static Enumeration provideTypeForEnum(final EnumTypeDefinition enumTypeDef, final String enumName, - final SchemaNode parentNode, final SchemaContext schemaContext, final ModuleContext context) { + final SchemaNode parentNode, final SchemaContext schemaContext, final + ModuleContext context) { Preconditions.checkArgument(enumTypeDef != null, "EnumTypeDefinition reference cannot be NULL!"); Preconditions.checkArgument(enumTypeDef.getQName().getLocalName() != null, "Local Name in EnumTypeDefinition QName cannot be NULL!"); @@ -485,16 +469,15 @@ public final class TypeGenHelper { /** * Converts typedef to the generated TO builder. * - * @param basePackageName - * string with name of package to which the module belongs - * @param typedef - * type definition from which is the generated TO builder created + * @param basePackageName string with name of package to which the module belongs + * @param typedef type definition from which is the generated TO builder created * @return generated TO builder which contains data from - * typedef and basePackageName + * typedef and basePackageName */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) private static GeneratedTOBuilderImpl typedefToTransferObject(final String basePackageName, - final TypeDefinition typedef, final String moduleName, final ModuleContext context) { + final TypeDefinition typedef, final String + moduleName, final ModuleContext context) { final String typeDefTOName = typedef.getQName().getLocalName(); if (basePackageName != null && typeDefTOName != null) { diff --git a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeProviderImpl.java b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeProviderImpl.java index 04f48d032a..33b0b86956 100755 --- a/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeProviderImpl.java +++ b/binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/yang/types/TypeProviderImpl.java @@ -30,6 +30,7 @@ import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.Sets; + import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -41,6 +42,7 @@ import java.util.Optional; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext; import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider; import org.opendaylight.mdsal.binding.javav2.generator.util.BindingGeneratorUtil; @@ -102,7 +104,7 @@ public final class TypeProviderImpl implements TypeProvider { private final SchemaContext schemaContext; /** - * Map>> + * Map<moduleName, Map<moduleDate, Map<typeName, type>>>. */ private final Map, Map>> genTypeDefsContextMap; @@ -112,24 +114,22 @@ public final class TypeProviderImpl implements TypeProvider { private final Map referencedTypes; /** - * Map for additional types e.g unions + * Map for additional types e.g unions. */ private final Map> additionalTypes; /** * Creates new instance of class TypeProviderImpl. * - * @param schemaContext - * contains the schema data red from YANG files - * @throws IllegalArgumentException - * if schemaContext equal null. + * @param schemaContext contains the schema data red from YANG files + * @throws IllegalArgumentException if schemaContext equal null. */ public TypeProviderImpl(final SchemaContext schemaContext) { this.schemaContext = schemaContext; this.genTypeDefsContextMap = new HashMap<>(); this.referencedTypes = new HashMap<>(); this.additionalTypes = new HashMap<>(); - resolveTypeDefsFromContext(schemaContext, this.genTypeDefsContextMap, this.additionalTypes); + resolveTypeDefsFromContext(); } @Override @@ -140,22 +140,19 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts schema definition type typeDefinition to JAVA - * Type + * Type. * - * @param type - * type definition which is converted to JAVA type - * @throws IllegalArgumentException - *
    - *
  • if typeDefinition equal null
  • - *
  • if QName of typeDefinition equal null
  • - *
  • if name of typeDefinition equal null
  • - *
+ * @param type type definition which is converted to JAVA type + * @throws IllegalArgumentException
    + *
  • if typeDefinition equal null
  • + *
  • if QName of typeDefinition equal null
  • + *
  • if name of typeDefinition equal null
  • + *
*/ @Override - public Type javaTypeForSchemaDefinitionType(final TypeDefinition type, final SchemaNode parentNode, final - Restrictions restrictions, final ModuleContext context) { - return javaTypeForSchemaDefType(type, parentNode, restrictions, this.schemaContext, this - .genTypeDefsContextMap, context); + public Type javaTypeForSchemaDefinitionType(final TypeDefinition type, final SchemaNode parentNode, + final Restrictions restrictions, final ModuleContext context) { + return javaTypeForSchemaDefType(type, parentNode, restrictions, context); } @Override @@ -181,6 +178,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 @@ -189,11 +187,8 @@ 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 SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, - final Map> additionalTypes) { + private void resolveTypeDefsFromContext() { final Set modules = schemaContext.getModules(); Preconditions.checkArgument(modules != null, "Set of Modules cannot be NULL!"); @@ -214,8 +209,7 @@ public final class TypeProviderImpl implements TypeProvider { BindingNamespaceType.Typedef); final List> typeDefinitions = getAllTypedefs(module); for (TypeDefinition typedef : sortTypeDefinitionAccordingDepth(typeDefinitions)) { - typedefToGeneratedType(basePackageName, module, typedef, genTypeDefsContextMap, - additionalTypes, schemaContext, context); + typedefToGeneratedType(basePackageName, module, typedef, context); } }); } @@ -223,20 +217,18 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts typeDefinition to concrete JAVA Type. * - * @param typeDefinition - * type definition which should be converted to JAVA - * Type + * @param typeDefinition type definition which should be converted to JAVA + * Type * @return JAVA Type which represents - * typeDefinition - * @throws IllegalArgumentException - *

    - *
  • if typeDefinition equal null
  • - *
  • if Q name of typeDefinition
  • - *
  • if name of typeDefinition
  • - *
+ * typeDefinition + * @throws IllegalArgumentException
    + *
  • if typeDefinition equal null
  • + *
  • if Q name of typeDefinition
  • + *
  • if name of typeDefinition
  • + *
*/ public Type generatedTypeForExtendedDefinitionType(final TypeDefinition typeDefinition, - final SchemaNode parentNode) { + final SchemaNode parentNode) { Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!"); Preconditions.checkArgument(typeDefinition.getQName().getLocalName() != null, "Type Definitions Local Name cannot be NULL!"); @@ -247,7 +239,7 @@ public final class TypeProviderImpl implements TypeProvider { if (module != null) { final Map, Map> modulesByDate = - this.genTypeDefsContextMap.get(module.getName()); + this.genTypeDefsContextMap.get(module.getName()); final Map genTOs = modulesByDate.get(module.getRevision()); if (genTOs != null) { return genTOs.get(typeDefinition.getQName().getLocalName()); @@ -258,18 +250,14 @@ public final class TypeProviderImpl implements TypeProvider { } /** - * Puts refType to map with key refTypePath - * - * @param refTypePath - * schema path used as the map key - * @param refType - * type which represents the map value - * @throws IllegalArgumentException - *
    - *
  • if refTypePath equal null
  • - *
  • if refType equal null
  • - *
+ * Puts refType to map with key refTypePath. * + * @param refTypePath schema path used as the map key + * @param refType type which represents the map value + * @throws IllegalArgumentException
    + *
  • if refTypePath equal null
  • + *
  • if refType equal null
  • + *
*/ public void putReferencedType(final SchemaPath refTypePath, final Type refType) { Preconditions.checkArgument(refTypePath != null, @@ -282,26 +270,25 @@ 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 - * type definition from which is the generated TO builder created - * @param typeDefName - * string with the name for generated TO builder + * @param basePackageName string with name of package to which the module belongs + * @param typeDef type definition from which is the generated TO builder created + * @param typeDefName string with the name for generated TO builder * @return generated TO builder which represents typeDef - * @throws IllegalArgumentException - *

    - *
  • if typeDef equals null
  • - *
  • if basePackageName equals null
  • - *
+ * @throws IllegalArgumentException
    + *
  • if typeDef equals null
  • + *
  • if basePackageName equals null
  • + *
*/ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public GeneratedTOBuilder provideGeneratedTOBuilderForBitsTypeDefinition(final String basePackageName, - final TypeDefinition typeDef, final String typeDefName, final String moduleName, - final ModuleContext context) { + final TypeDefinition typeDef, final + String typeDefName, final String + moduleName, + final ModuleContext context) { Preconditions.checkArgument(typeDef != null, "typeDef cannot be NULL!"); Preconditions.checkArgument(basePackageName != null, "Base Package Name cannot be NULL!"); @@ -324,7 +311,7 @@ public final class TypeProviderImpl implements TypeProvider { for (final Bit bit : bitList) { final String name = bit.getName(); genPropertyBuilder = genTOBuilder.addProperty( - JavaIdentifierNormalizer.normalizeSpecificIdentifier(name, JavaIdentifier.METHOD)); + JavaIdentifierNormalizer.normalizeSpecificIdentifier(name, JavaIdentifier.METHOD)); genPropertyBuilder.setReadOnly(true); genPropertyBuilder.setReturnType(BaseYangTypes.BOOLEAN_TYPE); @@ -343,26 +330,20 @@ public final class TypeProviderImpl implements TypeProvider { * 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 - * type definition which should be of type - * UnionTypeDefinition - * @param typeDefName - * string with name for generated TO + * @param basePackageName string with name of package to which the module belongs + * @param typedef type definition which should be of type + * UnionTypeDefinition + * @param typeDefName string with name for generated TO * @return generated TO builder which represents typedef - * @throws NullPointerException - *
    - *
  • if basePackageName is null
  • - *
  • if typedef is null
  • - *
  • if QName of typedef is null
  • - *
+ * @throws NullPointerException
    + *
  • if basePackageName is null
  • + *
  • if typedef is null
  • + *
  • if QName of typedef is null
  • + *
*/ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public List provideGeneratedTOBuildersForUnionTypeDef(final String basePackageName, final UnionTypeDefinition typedef, final String typeDefName, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { Preconditions.checkNotNull(basePackageName, "Base Package Name cannot be NULL!"); Preconditions.checkNotNull(typedef, "Type Definition cannot be NULL!"); @@ -387,19 +368,16 @@ public final class TypeProviderImpl implements TypeProvider { for (final TypeDefinition unionType : unionTypes) { final String unionTypeName = unionType.getQName().getLocalName(); if (unionType.getBaseType() != null) { - resolveExtendedSubtypeAsUnion(unionGenTOBuilder, unionType, expressions, - parentNode, schemaContext, genTypeDefsContextMap); + resolveExtendedSubtypeAsUnion(unionGenTOBuilder, unionType, expressions, parentNode); } else if (unionType instanceof UnionTypeDefinition) { generatedTOBuilders.add(resolveUnionSubtypeAsUnion(unionGenTOBuilder, (UnionTypeDefinition) unionType, - unionGenTOBuilder.getFullyQualifiedName(), parentNode, schemaContext, genTypeDefsContextMap, - context)); + unionGenTOBuilder.getFullyQualifiedName(), parentNode, context)); } else if (unionType instanceof EnumTypeDefinition) { final Enumeration enumeration = addInnerEnumerationToTypeBuilder((EnumTypeDefinition) unionType, unionTypeName, unionGenTOBuilder, context); updateUnionTypeAsProperty(unionGenTOBuilder, enumeration, unionTypeName); } else { - final Type javaType = javaTypeForSchemaDefType(unionType, parentNode, null, schemaContext, - genTypeDefsContextMap, context); + final Type javaType = javaTypeForSchemaDefType(unionType, parentNode, null, context); updateUnionTypeAsProperty(unionGenTOBuilder, javaType, unionTypeName); } } @@ -426,9 +404,7 @@ public final class TypeProviderImpl implements TypeProvider { } private Type javaTypeForSchemaDefType(final TypeDefinition typeDefinition, final SchemaNode parentNode, - final Restrictions r, final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, - final ModuleContext context) { + final Restrictions restrictions, final ModuleContext context) { Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!"); final String typedefName = typeDefinition.getQName().getLocalName(); Preconditions.checkArgument(typedefName != null, "Type Definitions Local Name cannot be NULL!"); @@ -439,16 +415,15 @@ public final class TypeProviderImpl implements TypeProvider { // and generated an enclosing ExtendedType to hold any range constraints. The new parser instantiates // a base type which holds these constraints. if (typeDefinition instanceof DecimalTypeDefinition) { - final Type ret = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType - (typeDefinition, parentNode, r, context); + final Type ret = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(typeDefinition, + parentNode, restrictions, context); if (ret != null) { return ret; } } // Deal with leafrefs/identityrefs - Type ret = javaTypeForLeafrefOrIdentityRef(typeDefinition, parentNode, schemaContext, - genTypeDefsContextMap, context); + Type ret = javaTypeForLeafrefOrIdentityRef(typeDefinition, parentNode, context); if (ret != null) { return ret; } @@ -462,8 +437,8 @@ public final class TypeProviderImpl implements TypeProvider { return ret; } - Type returnType = javaTypeForExtendedType(typeDefinition, schemaContext, genTypeDefsContextMap, context); - if (r != null && !r.isEmpty() && returnType instanceof GeneratedTransferObject) { + Type returnType = javaTypeForExtendedType(typeDefinition, context); + if (restrictions != null && !restrictions.isEmpty() && returnType instanceof GeneratedTransferObject) { final GeneratedTransferObject gto = (GeneratedTransferObject) returnType; final Module module = findParentModule(schemaContext, parentNode); final Module module1 = findParentModule(schemaContext, typeDefinition); @@ -474,32 +449,26 @@ public final class TypeProviderImpl implements TypeProvider { JavaIdentifierNormalizer.normalizeSpecificIdentifier(typedefName, JavaIdentifier.CLASS); final String name = packageName + "." + genTOName; if (module.equals(module1) && !returnType.getFullyQualifiedName().equals(name)) { - returnType = shadedTOWithRestrictions(gto, r, context); + returnType = shadedTOWithRestrictions(gto, restrictions, context); } } return returnType; } /** - * - * @param basePackageName - * string with name of package to which the module belongs - * @param module - * string with the name of the module for to which the - * typedef belongs - * @param typedef - * type definition of the node for which should be creted JAVA - * Type (usually generated TO) + * Return JAVA Type representation of typedef. + * @param basePackageName string with name of package to which the module belongs + * @param module string with the name of the module for to which the + * typedef belongs + * @param typedef type definition of the node for which should be creted JAVA + * Type (usually generated TO) * @return JAVA Type representation of typedef or - * null value if basePackageName or - * modulName or typedef or Q name of - * typedef equals null + * null value if basePackageName or + * modulName or typedef or Q name of + * typedef equals null */ private Type typedefToGeneratedType(final String basePackageName, final Module module, - final TypeDefinition typedef, - final Map, Map>> genTypeDefsContextMap, - final Map> additionalTypes, final SchemaContext schemaContext, - final ModuleContext context) { + final TypeDefinition typedef, final ModuleContext context) { final String moduleName = module.getName(); final Optional moduleRevision = module.getRevision(); if (basePackageName != null && moduleName != null && typedef != null) { @@ -513,8 +482,7 @@ public final class TypeProviderImpl implements TypeProvider { module.getName(), schemaContext, genTypeDefsContextMap, context); } else if (innerTypeDefinition instanceof UnionTypeDefinition) { final GeneratedTOBuilder genTOBuilder = provideGeneratedTOBuilderForUnionTypeDef(basePackageName, - (UnionTypeDefinition) innerTypeDefinition, typedefName, typedef, schemaContext, - genTypeDefsContextMap, context); + (UnionTypeDefinition) innerTypeDefinition, typedefName, typedef, context); genTOBuilder.setTypedef(true); genTOBuilder.setIsUnion(true); addUnitsToGenTO(genTOBuilder, typedef.getUnits().orElse(null)); @@ -536,11 +504,12 @@ public final class TypeProviderImpl implements TypeProvider { returnType = genTOBuilder.toInstance(); } else { final Type javaType = javaTypeForSchemaDefType(innerTypeDefinition, typedef, null, - schemaContext, genTypeDefsContextMap, context); + context); returnType = wrapJavaTypeIntoTO(basePackageName, typedef, javaType, module.getName(), context); } if (returnType != null) { - final Map, Map> modulesByDate = genTypeDefsContextMap.get(moduleName); + final Map, Map> modulesByDate = + genTypeDefsContextMap.get(moduleName); Map typeMap = modulesByDate.get(moduleRevision); if (typeMap != null) { if (typeMap.isEmpty()) { @@ -560,22 +529,20 @@ 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 + * @param typeDefinition type definition which is converted to JAVA Type * @return JAVA Type instance for typeDefinition */ - private Type javaTypeForExtendedType(final TypeDefinition typeDefinition, final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { + private Type javaTypeForExtendedType(final TypeDefinition typeDefinition, final ModuleContext context) { final String typedefName = typeDefinition.getQName().getLocalName(); final TypeDefinition baseTypeDef = baseTypeDefForExtendedType(typeDefinition); - Type returnType = javaTypeForLeafrefOrIdentityRef(baseTypeDef, typeDefinition, schemaContext, - genTypeDefsContextMap, context); + Type returnType = javaTypeForLeafrefOrIdentityRef(baseTypeDef, typeDefinition, context); if (returnType == null) { final Module module = findParentModule(schemaContext, typeDefinition); final Restrictions r = BindingGeneratorUtil.getRestrictions(typeDefinition); if (module != null) { - final Map, Map> modulesByDate = genTypeDefsContextMap.get(module.getName()); + final Map, Map> modulesByDate = genTypeDefsContextMap.get(module + .getName()); final Map genTOs = modulesByDate.get(module.getRevision()); if (genTOs != null) { returnType = genTOs.get(typedefName); @@ -594,19 +561,16 @@ public final class TypeProviderImpl implements TypeProvider { * LeafrefTypeDefinition or * IdentityrefTypeDefinition. * - * @param typeDefinition - * type definition which is converted to JAVA Type + * @param typeDefinition type definition which is converted to JAVA Type * @return JAVA Type instance for typeDefinition */ private Type javaTypeForLeafrefOrIdentityRef(final TypeDefinition typeDefinition, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { if (typeDefinition instanceof LeafrefTypeDefinition) { final LeafrefTypeDefinition leafref = (LeafrefTypeDefinition) typeDefinition; Preconditions.checkArgument(!isLeafRefSelfReference(leafref, parentNode, schemaContext), - "Leafref %s is referencing itself, incoming StackOverFlowError detected.", leafref); - return provideTypeForLeafref(leafref, parentNode, schemaContext, genTypeDefsContextMap, context); + "Leafref %s is referencing itself, incoming StackOverFlowError detected.", leafref); + return provideTypeForLeafref(leafref, parentNode, context); } else if (typeDefinition instanceof IdentityrefTypeDefinition) { final IdentityrefTypeDefinition idref = (IdentityrefTypeDefinition) typeDefinition; return provideTypeForIdentityref(idref, schemaContext); @@ -618,23 +582,19 @@ 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 + * @param leafrefType leafref type definition for which is the type sought * @return JAVA Type of data schema node which is referenced in - * leafrefType - * @throws IllegalArgumentException - *

    - *
  • if leafrefType equal null
  • - *
  • if path statement of leafrefType equal null
  • - *
- * + * leafrefType + * @throws IllegalArgumentException
    + *
  • if leafrefType equal null
  • + *
  • if path statement of leafrefType equal null
  • + *
*/ public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { Type returnType = null; Preconditions.checkArgument(leafrefType != null, "Leafref Type Definition reference cannot be NULL!"); @@ -649,7 +609,8 @@ public final class TypeProviderImpl implements TypeProvider { final Module module; final SchemaNode actualParentSchemaNode; if (parentNode instanceof DerivableSchemaNode && ((DerivableSchemaNode) parentNode).isAddedByUses()) { - final Optional originalNode = ((DerivableSchemaNode) parentNode).getOriginal(); + final Optional originalNode = ((DerivableSchemaNode) parentNode) + .getOriginal(); Preconditions.checkArgument(originalNode.isPresent(), "originalNode can not be null."); actualParentSchemaNode = originalNode.get(); module = findParentModule(schemaContext, originalNode.get()); @@ -666,14 +627,15 @@ public final class TypeProviderImpl implements TypeProvider { dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, actualParentSchemaNode, xpath); } Preconditions.checkArgument(dataNode != null, "Failed to find leafref target: %s in module %s (%s)", - strXPath, getParentModule(parentNode, schemaContext).getName(), parentNode.getQName().getModule()); + strXPath, getParentModule(parentNode, schemaContext).getName(), parentNode.getQName() + .getModule()); if (leafContainsEnumDefinition(dataNode)) { returnType = this.referencedTypes.get(dataNode.getPath()); } else if (leafListContainsEnumDefinition(dataNode)) { returnType = Types.listTypeFor(this.referencedTypes.get(dataNode.getPath())); } else { - returnType = resolveTypeFromDataSchemaNode(dataNode, schemaContext, genTypeDefsContextMap, context); + returnType = resolveTypeFromDataSchemaNode(dataNode, context); } } else { returnType = Types.typeForClass(Object.class); @@ -688,14 +650,13 @@ 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 + * @param dataNode data schema node for which is checked if it is leaf and if it + * is of enum type * @return boolean value - *
    - *
  • true - if dataNode is leaf of type enumeration
  • - *
  • false - other cases
  • - *
+ *
    + *
  • true - if dataNode is leaf of type enumeration
  • + *
  • false - other cases
  • + *
*/ private static boolean leafContainsEnumDefinition(final SchemaNode dataNode) { if (dataNode instanceof LeafSchemaNode) { @@ -712,15 +673,14 @@ 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 + * @param dataNode data schema node for which is checked if it is leaflist and if + * it is of enum type * @return boolean value - *
    - *
  • true - if dataNode is leaflist of type - * enumeration
  • - *
  • false - other cases
  • - *
+ *
    + *
  • true - if dataNode is leaflist of type + * enumeration
  • + *
  • false - other cases
  • + *
*/ private static boolean leafListContainsEnumDefinition(final SchemaNode dataNode) { if (dataNode instanceof LeafListSchemaNode) { @@ -735,24 +695,20 @@ public final class TypeProviderImpl implements TypeProvider { /** * Converts dataNode to JAVA Type. * - * @param dataNode - * contains information about YANG type + * @param dataNode contains information about YANG type * @return JAVA Type representation of dataNode */ - private Type resolveTypeFromDataSchemaNode(final SchemaNode dataNode, final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, - final ModuleContext context) { + private Type resolveTypeFromDataSchemaNode(final SchemaNode dataNode, final ModuleContext context) { Type returnType = null; if (dataNode != null) { if (dataNode instanceof LeafSchemaNode) { final LeafSchemaNode leaf = (LeafSchemaNode) dataNode; //not using CompatUtils here anymore final TypeDefinition type = leaf.getType(); - returnType = javaTypeForSchemaDefType(type, leaf, null, schemaContext, genTypeDefsContextMap, context); + returnType = javaTypeForSchemaDefType(type, leaf, null, context); } else if (dataNode instanceof LeafListSchemaNode) { final LeafListSchemaNode leafList = (LeafListSchemaNode) dataNode; - returnType = javaTypeForSchemaDefType(leafList.getType(), leafList, null, schemaContext, - genTypeDefsContextMap, context); + returnType = javaTypeForSchemaDefType(leafList.getType(), leafList, null, context); } } return returnType; @@ -763,18 +719,18 @@ public final class TypeProviderImpl implements TypeProvider { * 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 + * @param idref identityref type definition for which JAVA Type + * is sought * @return JAVA Type of the identity which is refrenced through - * idref + * idref */ private static Type provideTypeForIdentityref(final IdentityrefTypeDefinition idref, - final SchemaContext schemaContext) { + final SchemaContext schemaContext) { //TODO: incompatibility with Binding spec v2, get first or only one final QName baseIdQName = idref.getIdentities().iterator().next().getQName(); final Module module = schemaContext.findModule(baseIdQName.getModule()).orElse(null); @@ -787,10 +743,11 @@ public final class TypeProviderImpl implements TypeProvider { Preconditions.checkArgument(identity != null, "Target identity '" + baseIdQName + "' do not exists"); final String basePackageName = BindingMapping.getRootPackageName(module); - final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, identity.getPath - (), BindingNamespaceType.Identity); + final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, identity.getPath(), + BindingNamespaceType.Identity); - final String genTypeName = JavaIdentifierNormalizer.normalizeSpecificIdentifier(identity.getQName().getLocalName(), + final String genTypeName = JavaIdentifierNormalizer.normalizeSpecificIdentifier(identity.getQName() + .getLocalName(), JavaIdentifier.CLASS); final Type baseType = Types.typeForClass(Class.class); @@ -799,13 +756,13 @@ public final class TypeProviderImpl implements TypeProvider { } private static GeneratedTransferObject shadedTOWithRestrictions(final GeneratedTransferObject gto, - final Restrictions r, final ModuleContext context) { + final Restrictions restrictions, final ModuleContext context) { final GeneratedTOBuilder gtob = new GeneratedTOBuilderImpl(gto.getPackageName(), gto.getName(), context); final GeneratedTransferObject parent = gto.getSuperType(); if (parent != null) { gtob.setExtendsType(parent); } - gtob.setRestrictions(r); + gtob.setRestrictions(restrictions); for (final GeneratedProperty gp : gto.getProperties()) { final GeneratedPropertyBuilder gpb = gtob.addProperty(gp.getName()); gpb.setValue(gp.getValue()); @@ -822,20 +779,18 @@ 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 - * JAVA type of the property which should be added - * to unionGentransObject - * @param propertyName - * string with name of property which should be added to - * unionGentransObject + * @param unionGenTransObject generated TO to which should be property added + * @param type JAVA type of the property which should be added + * to unionGentransObject + * @param propertyName string with name of property which should be added to + * unionGentransObject */ private static void updateUnionTypeAsProperty(final GeneratedTOBuilder unionGenTransObject, final Type type, - final String propertyName) { + final String propertyName) { if (unionGenTransObject != null && type != null && !unionGenTransObject.containsProperty(propertyName)) { final GeneratedPropertyBuilder propBuilder = unionGenTransObject - .addProperty(JavaIdentifierNormalizer.normalizeSpecificIdentifier(propertyName, JavaIdentifier.METHOD)); + .addProperty(JavaIdentifierNormalizer.normalizeSpecificIdentifier(propertyName, JavaIdentifier + .METHOD)); propBuilder.setReturnType(type); unionGenTransObject.addEqualsIdentity(propBuilder); @@ -848,37 +803,31 @@ 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, UnionTypeDefinition, String, SchemaNode, SchemaContext, Map, ModuleContext)} + * call of method {@link #provideGeneratedTOBuilderForUnionTypeDef(String, UnionTypeDefinition, String, SchemaNode, + * SchemaContext, Map, ModuleContext)} * 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 - * @param basePackageName - * string with the name of the module package - * @param unionSubtype - * type definition which represents union subtype - * @return list of generated TO builders. The number of the builders can be - * bigger one due to recursive call of - * provideGeneratedTOBuildersForUnionTypeDef method. + * @param parentUnionGenTOBuilder generated TO builder to which is the property with the child + * union subtype added + * @param basePackageName string with the name of the module package + * @param unionSubtype type definition which represents union subtype + * @return list of generated TO builders. The number of the builders can be bigger one due to recursive call of + * provideGeneratedTOBuildersForUnionTypeDef method. */ private GeneratedTOBuilder resolveUnionSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder, final UnionTypeDefinition unionSubtype, final String basePackageName, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { final String newTOBuilderName = provideAvailableNameForGenTOBuilder(parentUnionGenTOBuilder.getName()); final GeneratedTOBuilder subUnionGenTOBUilder = provideGeneratedTOBuilderForUnionTypeDef( - basePackageName, unionSubtype, newTOBuilderName, parentNode, schemaContext, genTypeDefsContextMap, - context); + basePackageName, unionSubtype, newTOBuilderName, parentNode, context); final GeneratedPropertyBuilder propertyBuilder; propertyBuilder = parentUnionGenTOBuilder.addProperty( - JavaIdentifierNormalizer.normalizeSpecificIdentifier(newTOBuilderName, JavaIdentifier.METHOD)); + JavaIdentifierNormalizer.normalizeSpecificIdentifier(newTOBuilderName, JavaIdentifier.METHOD)); propertyBuilder.setReturnType(subUnionGenTOBUilder); parentUnionGenTOBuilder.addEqualsIdentity(propertyBuilder); parentUnionGenTOBuilder.addToStringProperty(propertyBuilder); @@ -890,24 +839,18 @@ 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 - * type definition which should be of type - * UnionTypeDefinition - * @param typeDefName - * string with name for generated TO - * @return generated TO builder with the list of enclosed generated TO - * builders + * @param basePackageName string with name of package to which the module belongs + * @param typedef type definition which should be of type + * UnionTypeDefinition + * @param typeDefName string with name for generated TO + * @return generated TO builder with the list of enclosed generated TO builders */ public GeneratedTOBuilder provideGeneratedTOBuilderForUnionTypeDef(final String basePackageName, final UnionTypeDefinition typedef, final String typeDefName, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap, final ModuleContext context) { final List builders = provideGeneratedTOBuildersForUnionTypeDef(basePackageName, - typedef, typeDefName, parentNode, schemaContext, genTypeDefsContextMap, context); + typedef, typeDefName, parentNode, context); Preconditions.checkState(!builders.isEmpty(), "No GeneratedTOBuilder objects generated from union %s", typedef); final GeneratedTOBuilder resultTOBuilder = builders.remove(0); @@ -929,7 +872,7 @@ public final class TypeProviderImpl implements TypeProvider { private GeneratedTOBuilder provideGeneratedTOBuilderForUnionBuilder(final Module parentModule, - final GeneratedTOBuilder genTOBuilder) { + final GeneratedTOBuilder genTOBuilder) { final String outerCls = Types.getOuterClassName(genTOBuilder); final StringBuilder name; if (outerCls != null) { @@ -964,25 +907,19 @@ 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 - * type definition of the ExtendedType type which - * represents union subtype - * @param expressions - * map of strings with the regular expressions - * @param parentNode - * parent Schema Node for Extended Subtype - * + * @param parentUnionGenTOBuilder generated TO builder in which new property is created + * @param unionSubtype type definition of the ExtendedType type which + * represents union subtype + * @param expressions map of strings with the regular expressions + * @param parentNode parent Schema Node for Extended Subtype */ private void resolveExtendedSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder, - final TypeDefinition unionSubtype, final Map expressions, final SchemaNode parentNode, - final SchemaContext schemaContext, - final Map, Map>> genTypeDefsContextMap) { + final TypeDefinition unionSubtype, final Map expressions, final SchemaNode parentNode) { final String unionTypeName = unionSubtype.getQName().getLocalName(); final Type genTO = findGenTO(unionTypeName, unionSubtype, schemaContext, genTypeDefsContextMap); if (genTO != null) { @@ -1011,7 +948,7 @@ public final class TypeProviderImpl implements TypeProvider { } if (!typeExist && javaType != null) { updateUnionTypeAsProperty(parentUnionGenTOBuilder, javaType, - javaType.getName() + parentUnionGenTOBuilder.getName() + "Value"); + javaType.getName() + parentUnionGenTOBuilder.getName() + "Value"); } } if (baseType instanceof StringTypeDefinition) { @@ -1024,8 +961,7 @@ public final class TypeProviderImpl implements TypeProvider { * 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 + * @param name string with name of augmented node * @return string with the number suffix incremented by one (or 1 is added) */ private static String provideAvailableNameForGenTOBuilder(final String name) { @@ -1040,19 +976,20 @@ public final class TypeProviderImpl implements TypeProvider { /** * Searches for generated TO for searchedTypeDef type - * definition in {@link #genTypeDefsContextMap genTypeDefsContextMap} + * definition in {@link #genTypeDefsContextMap genTypeDefsContextMap}. * - * @param searchedTypeName - * string with name of searchedTypeDef + * @param searchedTypeName string with name of searchedTypeDef * @return generated TO for searchedTypeDef or - * null it it doesn't exist + * null it it doesn't exist */ private static Type findGenTO(final String searchedTypeName, final SchemaNode parentNode, - final SchemaContext schemaContext, final Map, Map>> genTypeDefsContextMap) { + final SchemaContext schemaContext, final Map, + Map>> genTypeDefsContextMap) { final Module typeModule = findParentModule(schemaContext, parentNode); if (typeModule != null && typeModule.getName() != null) { - final Map, Map> modulesByDate = genTypeDefsContextMap.get(typeModule.getName()); + final Map, Map> modulesByDate = genTypeDefsContextMap.get(typeModule + .getName()); final Map genTOs = modulesByDate.get(typeModule.getRevision()); if (genTOs != null) { return genTOs.get(searchedTypeName); @@ -1065,27 +1002,24 @@ 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 - * @param enumName - * string with the name of enumeration - * @param typeBuilder - * generated type builder to which is enumeration added + * @param enumTypeDef enumeration type definition is source of enumeration data for + * typeBuilder + * @param enumName string with the name of enumeration + * @param typeBuilder generated type builder to which is enumeration added * @return enumeration type which contains enumeration data form - * enumTypeDef - * @throws IllegalArgumentException - *

    - *
  • if enumTypeDef equals null
  • - *
  • if enum values of enumTypeDef equal null
  • - *
  • if Q name of enumTypeDef equal null
  • - *
  • if name of enumTypeDef equal null
  • - *
  • if name of typeBuilder equal null
  • - *
- * + * enumTypeDef + * @throws IllegalArgumentException
    + *
  • if enumTypeDef equals null
  • + *
  • if enum values of enumTypeDef equal null
  • + *
  • if Q name of enumTypeDef equal null
  • + *
  • if name of enumTypeDef equal null
  • + *
  • if name of typeBuilder equal null
  • + *
*/ private static Enumeration addInnerEnumerationToTypeBuilder(final EnumTypeDefinition enumTypeDef, - final String enumName, final GeneratedTypeBuilderBase typeBuilder, final ModuleContext context) { + final String enumName, final + GeneratedTypeBuilderBase typeBuilder, final + ModuleContext context) { Preconditions.checkArgument(enumTypeDef != null, "EnumTypeDefinition reference cannot be NULL!"); Preconditions.checkArgument(enumTypeDef.getQName().getLocalName() != null, "Local Name in EnumTypeDefinition QName cannot be NULL!"); @@ -1099,7 +1033,7 @@ public final class TypeProviderImpl implements TypeProvider { } private static boolean isLeafRefSelfReference(final LeafrefTypeDefinition leafref, final SchemaNode parentNode, - final SchemaContext schemaContext) { + final SchemaContext schemaContext) { final SchemaNode leafRefValueNode; final RevisionAwareXPath leafRefXPath = leafref.getPathStatement(); final RevisionAwareXPath leafRefStrippedXPath = new RevisionAwareXPathImpl(leafRefXPath.toString() diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenTypeTest.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenTypeTest.java index fd8ff86737..638da24713 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenTypeTest.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenTypeTest.java @@ -49,6 +49,7 @@ import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; public class AugmentToGenTypeTest { + @SuppressWarnings({"checkstyle:avoidHidingCauseException", "checkstyle:illegalThrows", "checkstyle:illegalCatch"}) @Test(expected = UnsupportedOperationException.class) public void constructorTest() throws Throwable { final Constructor constructor = AugmentToGenType.class.getDeclaredConstructor(); @@ -725,7 +726,8 @@ public class AugmentToGenTypeTest { when(targetNode.getReference()).thenReturn(Optional.empty()); final Map genCtx = new HashMap<>(); final ModuleContext moduleContext = new ModuleContext(); - final GeneratedTypeBuilder gtb = new GeneratedTypeBuilderImpl(pckgName, "test-case-node-augment", moduleContext); + final GeneratedTypeBuilder gtb = new GeneratedTypeBuilderImpl(pckgName, "test-case-node-augment", + moduleContext); when(targetType.getParentTypeForBuilder()).thenReturn(gtb); genCtx.put(module, moduleContext); final Map> genTypeBuilder = new HashMap<>(); diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtilsTest.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtilsTest.java index b2bea753fd..cdd227a746 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtilsTest.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtilsTest.java @@ -58,6 +58,7 @@ import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; public class AuxiliaryGenUtilsTest { + @SuppressWarnings({"checkstyle:avoidHidingCauseException", "checkstyle:illegalThrows", "checkstyle:illegalCatch"}) @Test(expected = UnsupportedOperationException.class) public void constructorTest() throws Throwable { final Constructor constructor = AuxiliaryGenUtils.class.getDeclaredConstructor(); diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImplTest.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImplTest.java index 171808dbbe..889ab25f75 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImplTest.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImplTest.java @@ -243,26 +243,26 @@ public class BindingGeneratorImplTest { assertBaseGeneratedType(genTransferObj, "MyListKey", "org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list"); assertEquals(3, genTransferObj.getProperties().size()); - int test_j = 0; + int testJ = 0; for (final GeneratedProperty generatedProperty : genTransferObj.getProperties()) { switch (generatedProperty.getName()) { case "keyReservedWord": assertEquals("String", generatedProperty.getReturnType().getName()); - test_j++; + testJ++; break; case "key1": assertEquals("String", generatedProperty.getReturnType().getName()); - test_j++; + testJ++; break; case "key2": assertEquals("String", generatedProperty.getReturnType().getName()); - test_j++; + testJ++; break; default: fail(); } } - assertEquals(3, test_j); + assertEquals(3, testJ); test_i[0] += 1; } else { testActualType((GeneratedType) t, test_i); @@ -317,79 +317,78 @@ public class BindingGeneratorImplTest { } } - private void testActualType(final GeneratedType t, final int[] test_i) { + private void testActualType(final GeneratedType type, final int[] testI) { MethodSignature methodSignature = null; - switch (t.getName()) { + switch (type.getName()) { case "TestListData": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314", - t.getPackageName()); - methodSignature = t.getMethodDefinitions().get(0); - assertMethod(t, "getMyList", "List", "java.util", methodSignature); - test_i[0] += 1; + type.getPackageName()); + methodSignature = type.getMethodDefinitions().get(0); + assertMethod(type, "getMyList", "List", "java.util", methodSignature); + testI[0] += 1; break; case "MyListKey": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list", - t.getPackageName()); - methodSignature = t.getMethodDefinitions().get(0); - assertMethod(t, "getKey", "String", "java.lang", methodSignature); - test_i[0] += 1; + type.getPackageName()); + methodSignature = type.getMethodDefinitions().get(0); + assertMethod(type, "getKey", "String", "java.lang", methodSignature); + testI[0] += 1; break; case "MyListKey1": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list", - t.getPackageName()); - methodSignature = t.getMethodDefinitions().get(0); - assertMethod(t, "getKey1", "String", "java.lang", methodSignature); - test_i[0] += 1; + type.getPackageName()); + methodSignature = type.getMethodDefinitions().get(0); + assertMethod(type, "getKey1", "String", "java.lang", methodSignature); + testI[0] += 1; break; case "MyListKey2": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list", - t.getPackageName()); - methodSignature = t.getMethodDefinitions().get(0); - assertMethod(t, "getKey2", "String", "java.lang", methodSignature); - test_i[0] += 1; + type.getPackageName()); + methodSignature = type.getMethodDefinitions().get(0); + assertMethod(type, "getKey2", "String", "java.lang", methodSignature); + testI[0] += 1; break; case "MyListFoo": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.data.my_list", - t.getPackageName()); - methodSignature = t.getMethodDefinitions().get(0); - assertMethod(t, "getFoo", "String", "java.lang", methodSignature); - test_i[0] += 1; + type.getPackageName()); + methodSignature = type.getMethodDefinitions().get(0); + assertMethod(type, "getFoo", "String", "java.lang", methodSignature); + testI[0] += 1; break; case "MyList": assertEquals("org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.data", - t.getPackageName()); - assertEquals(5, t.getMethodDefinitions().size()); - int test_j = 0; - for (final MethodSignature m : t.getMethodDefinitions()) { + type.getPackageName()); + assertEquals(5, type.getMethodDefinitions().size()); + int testJ = 0; + for (final MethodSignature m : type.getMethodDefinitions()) { switch (m.getName()) { case "getIdentifier": - assertMethod(t, "getIdentifier", "MyListKey", - "org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list", - m); - test_j++; + assertMethod(type, "getIdentifier", "MyListKey", + "org.opendaylight.mdsal.gen.javav2.urn.test.simple.test.list.rev170314.key.my_list", m); + testJ++; break; case "getKey1": - assertMethod(t, "getKey1", "String","java.lang", m); - test_j++; + assertMethod(type, "getKey1", "String","java.lang", m); + testJ++; break; case "getKey2": - assertMethod(t, "getKey2", "String","java.lang", m); - test_j++; + assertMethod(type, "getKey2", "String","java.lang", m); + testJ++; break; case "getFoo": - assertMethod(t, "getFoo", "String","java.lang", m); - test_j++; + assertMethod(type, "getFoo", "String","java.lang", m); + testJ++; break; case "getKeyReservedWord": - assertMethod(t, "getKeyReservedWord", "String","java.lang", m); - test_j++; + assertMethod(type, "getKeyReservedWord", "String","java.lang", m); + testJ++; break; default: fail(); } } - assertEquals(5, test_j); - test_i[0] += 1; + assertEquals(5, testJ); + testI[0] += 1; break; default: fail(); diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8542Test.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8542Test.java index 6a5f22f3c5..71ef89cb1b 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8542Test.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8542Test.java @@ -34,8 +34,9 @@ public class Bug8542Test { assertEquals("org.opendaylight.mdsal.gen.javav2.yang.test.uses.augment.recursive.rev170519.data.d.a1", type.getPackageName()); } else if (type.getName().equals("C11")) { - assertEquals("org.opendaylight.mdsal.gen.javav2.yang.test.uses.augment.recursive.rev170519.data.d.a1.b1", - type.getPackageName()); + assertEquals( + "org.opendaylight.mdsal.gen.javav2.yang.test.uses.augment.recursive.rev170519.data.d.a1.b1", + type.getPackageName()); } } } diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelperTest.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelperTest.java index 24cb75081a..88d9ab75c1 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelperTest.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/RpcActionGenHelperTest.java @@ -43,12 +43,13 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; public class RpcActionGenHelperTest { // Bridge for method references @FunctionalInterface - private static interface GeneratorMethod { + private interface GeneratorMethod { Map generate(Module module, Map genCtx, SchemaContext schemaContext, boolean verboseClassComments, Map> genTypeBuilders, TypeProvider typeProvider); } + @SuppressWarnings({"checkstyle:avoidHidingCauseException", "checkstyle:illegalThrows", "checkstyle:illegalCatch"}) @Test(expected = UnsupportedOperationException.class) public void constructorTest() throws Throwable { final Constructor constructor = RpcActionGenHelper.class.getDeclaredConstructor(); diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/UnionTypeDefTest.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/UnionTypeDefTest.java index 1aadf9ded9..73f76670b7 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/UnionTypeDefTest.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/UnionTypeDefTest.java @@ -58,6 +58,8 @@ public class UnionTypeDefTest { case "value": assertEquals(Types.CHAR_ARRAY, generatedProperty.getReturnType()); break; + default: + break; } } } diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallInput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallInput.java index 7613bc40b2..74f25cbaac 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallInput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallInput.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * action my-action-call input + * action my-action-call input. */ public interface MyActionCallInput extends Input, Instantiable, TreeNode { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallOutput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallOutput.java index 8bd404d544..2158dd3b5c 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallOutput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionCallOutput.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Output; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * action my-action-call output + * action my-action-call output. */ public interface MyActionCallOutput extends Output, Instantiable, TreeNode { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionModuleMyActionCallAction.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionModuleMyActionCallAction.java index f71a1cf9af..441c8b04a3 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionModuleMyActionCallAction.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyActionModuleMyActionCallAction.java @@ -15,26 +15,29 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.RpcCallback; /** * It represents following YANG snippet: * + *

* module my-action-module { * + *

* container my-cont { * action my-action-call { * + *

* input { * leaf v1 { * type string; * } * } * + *

* output { * leaf v2 { * type string * } * } - * * } * } - * } + * }. */ public interface MyActionModuleMyActionCallAction extends Action, MyActionCallInput, MyActionCallOutput> { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyCont.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyCont.java index 64d81e5ae2..dcbee86ebe 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyCont.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/action/examples/MyCont.java @@ -12,7 +12,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; import org.opendaylight.mdsal.binding.javav2.spec.structural.Augmentable; /** - * container my-cont + * container my-cont. */ public interface MyCont extends TreeNode, Augmentable { } diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallInput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallInput.java index c8fea95d4a..e1ab4f298e 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallInput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallInput.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * action list-action-call input + * action list-action-call input. */ public interface ListActionCallInput extends Input, Instantiable, TreeNode { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallOutput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallOutput.java index 4b6cc4f207..1868b3911e 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallOutput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionCallOutput.java @@ -13,9 +13,10 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Output; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * action list-action-call output + * action list-action-call output. */ -public interface ListActionCallOutput extends Output, Instantiable, TreeNode { +public interface ListActionCallOutput extends Output, Instantiable, + TreeNode { @Override Class implementedInterface(); diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionModuleListActionCall.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionModuleListActionCall.java index 377a25d6cc..2fe0cf1631 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionModuleListActionCall.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/ListActionModuleListActionCall.java @@ -15,29 +15,34 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.RpcCallback; /** * It represents following YANG snippet: * + *

* module list-action-module { * + *

* list my-list { * action list-action-call { * + *

* input { * leaf v1 { * type string; * } * } * + *

* output { * leaf v2 { * type string * } * } - * * } * } - * } + * }. */ -public interface ListActionModuleListActionCall extends ListAction { +public interface ListActionModuleListActionCall extends ListAction { @Override - void invoke(ListActionCallInput input, KeyedInstanceIdentifier kii, RpcCallback callback); + void invoke(ListActionCallInput input, KeyedInstanceIdentifier kii, + RpcCallback callback); } diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyList.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyList.java index 0c82eab31a..3b3a9a02e9 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyList.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyList.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.structural.Augmentable; import org.opendaylight.yangtools.concepts.Identifiable; /** - * list my-list + * list my-list. */ public interface MyList extends TreeNode, Augmentable, Identifiable { } diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyListKey.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyListKey.java index ee8a824ceb..eb67a1fe6b 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyListKey.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/list/action/examples/MyListKey.java @@ -11,7 +11,7 @@ package org.opendaylight.mdsal.binding.javav2.generator.impl.list.action.example import org.opendaylight.yangtools.concepts.Identifier; /** - * key of list my-list + * key of list my-list. */ public class MyListKey implements Identifier { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallInput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallInput.java index 026fb84be8..6c5c85893b 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallInput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallInput.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * rpc my-call input + * rpc my-call input. */ public interface MyCallInput extends Input, Instantiable, TreeNode { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallOutput.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallOutput.java index ce5d9f9afb..75b40d0e8d 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallOutput.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyCallOutput.java @@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.Output; import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode; /** - * rpc my-call output + * rpc my-call output. */ public interface MyCallOutput extends Output, Instantiable, TreeNode { diff --git a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyModuleMyCallRpc.java b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyModuleMyCallRpc.java index 69ef38a92e..5a56df08ae 100644 --- a/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyModuleMyCallRpc.java +++ b/binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/rpc/examples/MyModuleMyCallRpc.java @@ -14,23 +14,27 @@ import org.opendaylight.mdsal.binding.javav2.spec.base.RpcCallback; /** * It represents following YANG snippet: * + *

* module my-module { * + *

* rpc my-call { * + *

* input { * leaf v1 { * type string; * } * } * + *

* output { * leaf v2 { * type string * } * } * } - * } + * }. */ public interface MyModuleMyCallRpc extends Rpc { -- 2.36.6