Fix checkstyle in mdsal-binding-dom-codec 18/64418/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Oct 2017 18:17:48 +0000 (20:17 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Oct 2017 18:25:05 +0000 (20:25 +0200)
Fix checkstyle issues and activate enforcement.

Change-Id: I5ef078ba907284d5885521971cb0391a28fa2e57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
62 files changed:
binding/mdsal-binding-dom-codec-osgi/pom.xml
binding/mdsal-binding-dom-codec-osgi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/osgi/impl/ModuleInfoBundleTracker.java
binding/mdsal-binding-dom-codec-osgi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/osgi/impl/OsgiModuleInfoRegistry.java
binding/mdsal-binding-dom-codec/pom.xml
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTree.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTreeNode.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingNormalizedNodeCachingCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingNormalizedNodeWriterFactory.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractGenerator.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractStreamWriterGenerator.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AugmentableDataNodeContainerEmitterSource.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/DataNodeContainerSerializerSource.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/DataObjectSerializerPrototype.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/DataObjectSerializerSource.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/StreamWriterGenerator.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/spi/AbstractSource.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/spi/StaticConstantDefinition.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/AbstractBindingNormalizedNodeCacheHolder.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/AugmentationNodeContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingNormalizedNodeCache.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingNormalizedNodeCodecRegistry.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingToNormalizedStreamWriter.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BitsCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/CachingNormalizedNodeSerializer.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/CaseNodeCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ChoiceNodeCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataContainerCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataContainerCodecPrototype.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataObjectCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/EncapsulatedValueCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/IdentifiableItemCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/IncorrectNestingException.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/KeyedListNodeCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/LazyDataObject.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/LeafNodeCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/MissingSchemaException.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/MissingSchemaForClassException.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/NodeCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/NotificationCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/RpcInputCodec.java [moved from binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/RpcInputDataObjectCodec.java with 99% similarity]
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/SchemaRootCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/UnionTypeCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/UnionValueOptionContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ValueContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ValueTypeCodec.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/util/AugmentableDispatchSerializer.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/util/AugmentationReader.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/util/ChoiceDispatchSerializer.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/impl/UnionValueOptionContextTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/AugmentationClassDiscoveredAfterCodecTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/AugmentationSubstitutionTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/BinaryKeyTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/EmptyLeafTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/ExceptionReportingTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/InstanceIdentifierSerializeDeserializeTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/LeafReferenceTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/LeafrefSerializeDeserializeTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/NormalizedNodeSerializeDeserializeTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/NotificationProcessingTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/UnionTypeTest.java
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/mdsal/binding/dom/codec/test/UnionTypeWithIdentityrefTest.java

index 9a6c6418e10ba229dd02502f1cce93509ee015c4..ede0c9f6aa74921f517b5603c73e1a49393b530e 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 
 </project>
index fd93e312d36da82794838b1a4023c51dff69f5d6..460a10a9e325c9cce4c1d347c4cabafb00ccf0af 100644 (file)
@@ -28,7 +28,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Tracks bundles and attempts to retrieve YangModuleInfo, which is then fed into ModuleInfoRegistry
+ * Tracks bundles and attempts to retrieve YangModuleInfo, which is then fed into ModuleInfoRegistry.
  */
 final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collection<ObjectRegistration<YangModuleInfo>>> {
     private static final Logger LOG = LoggerFactory.getLogger(ModuleInfoBundleTracker.class);
@@ -54,6 +54,7 @@ final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collectio
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public Collection<ObjectRegistration<YangModuleInfo>> addingBundle(final Bundle bundle, final BundleEvent event) {
         final URL resource = bundle.getEntry(YANG_MODLE_BINDING_PROVIDER_SERVICE);
         if (resource == null) {
@@ -104,6 +105,7 @@ final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collectio
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public void removedBundle(final Bundle bundle, final BundleEvent event,
             final Collection<ObjectRegistration<YangModuleInfo>> regs) {
         if (regs == null) {
index 6b63cf8a7a9dad6c239a6e1fedb7098110bceb2a..e1d7e464864429c14b6082e5ac93f34d9ccbfc0c 100644 (file)
@@ -42,6 +42,7 @@ final class OsgiModuleInfoRegistry implements ModuleInfoRegistry {
         this.runtimeContext = checkNotNull(runtimeContext);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     synchronized void updateService() {
         final SchemaContext context;
         try {
@@ -78,6 +79,7 @@ final class OsgiModuleInfoRegistry implements ModuleInfoRegistry {
         }
 
         @Override
+        @SuppressWarnings("checkstyle:illegalCatch")
         public void close() throws Exception {
             try {
                 inner.close();
index c891233321db6e7504c167d08a1c0f1948d10319..ea0f0d964b69fdec85fb362203e5c358356d9dd1 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 
 </project>
index b0b75e549fa906752bac1f53a536213348686856..4c3210722433cd59a77fd185155260e65584cbda 100644 (file)
@@ -14,13 +14,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
- * Navigable tree representing hierarchy of Binding to Normalized Node codecs
- *
- * This navigable tree is associated to conrete set of YANG models, represented by SchemaContext and
- * provides access to subtree specific serialization context.
- *
- * TODO: Add more detailed documentation
- **/
+ * Navigable tree representing hierarchy of Binding to Normalized Node codecs. This navigable tree is associated to
+ * a concrete set of YANG models, represented by SchemaContext and provides access to subtree specific serialization
+ * context.
+ */
+// TODO: Add more detailed documentation
 public interface BindingCodecTree {
 
     @Nullable
index 6943433667a04a005c7de6e52e7ab530a628d400..25a4d43e6de32a77adf58d7dfc94c2e4ab08ebfd 100644 (file)
@@ -20,18 +20,14 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 
 /**
- * Subtree codec specific to model subtree between Java Binding and
- * NormalizedNode.
+ * Subtree codec specific to model subtree between Java Binding and NormalizedNode.
  */
 @Beta
 public interface BindingCodecTreeNode<T extends DataObject> extends BindingNormalizedNodeCodec<T> {
 
     /**
-     * Returns binding class of interface which represents API of current
-     * schema node.
-     *
-     * The result is same as invoking {@link DataObject#getImplementedInterface()}
-     * on instance of data.
+     * Returns binding class of interface which represents API of current schema node. The result is same as invoking
+     * {@link DataObject#getImplementedInterface()} on instance of data.
      *
      * @return interface which defines API of binding representation of data.
      */
@@ -39,9 +35,8 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
     Class<T> getBindingClass();
 
     /**
-     * Returns child context as if it was walked by
-     * {@link BindingStreamEventWriter}. This means that to enter case, one must
-     * issue getChild(ChoiceClass).getChild(CaseClass).
+     * Returns child context as if it was walked by {@link BindingStreamEventWriter}. This means that to enter case,
+     * one must issue getChild(ChoiceClass).getChild(CaseClass).
      *
      * @param childClass Child class by Biding Stream navigation
      * @return Context of child
@@ -52,24 +47,23 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
     <E extends DataObject> BindingCodecTreeNode<E> streamChild(@Nonnull Class<E> childClass);
 
     /**
-     * Returns child context as if it was walked by
-     * {@link BindingStreamEventWriter}. This means that to enter case, one must
-     * issue getChild(ChoiceClass).getChild(CaseClass).
+     * Returns child context as if it was walked by {@link BindingStreamEventWriter}. This means that to enter case,
+     * one must issue getChild(ChoiceClass).getChild(CaseClass).
      *
-     * This method differs from {@link #streamChild(Class)}, that is less
-     * stricter for interfaces representing augmentation and cases, that
-     * may return {@link BindingCodecTreeNode} even if augmentation interface
-     * containing same data was supplied and does not represent augmentation
-     * of this node.
+     * <p>
+     * This method differs from {@link #streamChild(Class)}, that is less strict for interfaces representing
+     * augmentation and cases, that may return {@link BindingCodecTreeNode} even if augmentation interface containing
+     * same data was supplied and does not represent augmentation of this node.
      *
      * @param childClass
      * @return Context of child or Optional absent is supplied class is not
      *         applicable in context.
      */
-    <E extends DataObject> Optional<? extends BindingCodecTreeNode<E>> possibleStreamChild(@Nonnull Class<E> childClass);
+    <E extends DataObject> Optional<? extends BindingCodecTreeNode<E>> possibleStreamChild(
+            @Nonnull Class<E> childClass);
 
     /**
-     * Returns nested node context using supplied YANG Instance Identifier
+     * Returns nested node context using supplied YANG Instance Identifier.
      *
      * @param child
      *            Yang Instance Identifier Argument
@@ -81,8 +75,8 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
     BindingCodecTreeNode<?> yangPathArgumentChild(@Nonnull YangInstanceIdentifier.PathArgument child);
 
     /**
-     * Returns nested node context using supplied Binding Instance Identifier
-     * and adds YANG instance identifiers to supplied list.
+     * Returns nested node context using supplied Binding Instance Identifier and adds YANG instance identifiers to
+     * the supplied list.
      *
      * @param arg
      *            Binding Instance Identifier Argument
@@ -98,12 +92,12 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
             @Nullable List<YangInstanceIdentifier.PathArgument> builder);
 
     /**
-     * Returns codec which uses caches serialization / deserialization results
+     * Returns codec which uses caches serialization / deserialization results.
      *
+     * <p>
      * Caching may introduce performance penalty to serialization / deserialization
      * but may decrease use of heap for repetitive objects.
      *
-     *
      * @param cacheSpecifier Set of objects, for which cache may be in place
      * @return Codec whihc uses cache for serialization / deserialization.
      */
@@ -136,7 +130,8 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
      * @throws IllegalArgumentException If supplied {@code arg} is not valid.
      */
     @Beta
-    @Nullable InstanceIdentifier.PathArgument deserializePathArgument(@Nullable YangInstanceIdentifier.PathArgument arg);
+    @Nullable InstanceIdentifier.PathArgument deserializePathArgument(
+            @Nullable YangInstanceIdentifier.PathArgument arg);
 
     Object getSchema();
 }
index 08a52655adb63a36e81820b146d251ab84a74d4f..71981b1290abbdc64b87c90b9a52ba9af2518f87 100644 (file)
@@ -11,10 +11,8 @@ import com.google.common.annotations.Beta;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
- * Caching variant of Binding to Normalized Node codec.
- *
- * Caching may introduce performance penalty to serialization / deserialization
- * but may decrease use of heap for repetitive objects.
+ * Caching variant of Binding to Normalized Node codec. Caching may introduce performance penalty to serialization and
+ * deserialization but may decrease use of heap for repetitive objects.
  *
  * @param <T> Binding representtion of data
  */
@@ -22,11 +20,8 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 public interface BindingNormalizedNodeCachingCodec<T extends DataObject> extends BindingNormalizedNodeCodec<T>,
         AutoCloseable {
     /**
-     * Invoking close will invalidate this codec and any of its child
-     * codecs and will invalidate cache.
-     *
-     * Any subsequent calls to this codec will fail with {@link IllegalStateException}
-     * thrown.
+     * Invoking close will invalidate this codec and any of its child codecs and will invalidate cache. Any subsequent
+     * calls to this codec will fail with {@link IllegalStateException} thrown.
      */
     @Override
     void close();
index 8a41021a04f72f4574061864f4d0cee33ae17a93..3c277115f110360fa53d6e44413bc642344b642d 100644 (file)
@@ -17,22 +17,21 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 
 /**
- * Factory for {@link BindingStreamEventWriter}, which provides stream writers
- * which translates data and delegates calls to {@link NormalizedNodeStreamWriter}.
+ * Factory for {@link BindingStreamEventWriter}, which provides stream writers which translates data and delegates
+ * calls to {@link NormalizedNodeStreamWriter}.
  */
 public interface BindingNormalizedNodeWriterFactory {
     /**
-     * Creates a {@link BindingStreamEventWriter} for data tree path which will
-     * translate to NormalizedNode model and invoke proper events on supplied
-     * {@link NormalizedNodeStreamWriter}.
+     * Creates a {@link BindingStreamEventWriter} for data tree path which will translate to NormalizedNode model
+     * and invoke proper events on supplied {@link NormalizedNodeStreamWriter}.
+     *
      * <p>
-     * Also provides translation of supplied Instance Identifier to
-     * {@link YangInstanceIdentifier} so client code, does not need to translate
-     * that separately.
+     * Also provides translation of supplied Instance Identifier to {@link YangInstanceIdentifier} so client code, does
+     * not need to translate that separately.
+     *
      * <p>
      * If {@link YangInstanceIdentifier} is not needed, please use
-     * {@link #newWriter(InstanceIdentifier, NormalizedNodeStreamWriter)}
-     * method to conserve resources.
+     * {@link #newWriter(InstanceIdentifier, NormalizedNodeStreamWriter)} method to conserve resources.
      *
      * @param path
      *            Binding Path in conceptual data tree, for which writer should
@@ -47,14 +46,13 @@ public interface BindingNormalizedNodeWriterFactory {
             @Nonnull InstanceIdentifier<?> path, @Nonnull NormalizedNodeStreamWriter domWriter);
 
     /**
-     * Creates a {@link BindingStreamEventWriter} for data tree path which will
-     * translate to NormalizedNode model and invoke proper events on supplied
-     * {@link NormalizedNodeStreamWriter}.
-     * <p>
+     * Creates a {@link BindingStreamEventWriter} for data tree path which will translate to NormalizedNode model
+     * and invoke proper events on supplied {@link NormalizedNodeStreamWriter}.
      *
-     * This variation does not provide YANG instance identifier and is useful
-     * for use-cases, where {@link InstanceIdentifier} translation is done
-     * in other way, or YANG instance identifier is unnecessary (e.g. notifications, RPCs).
+     * <p>
+     * This variant does not provide YANG instance identifier and is useful for use-cases, where
+     * {@link InstanceIdentifier} translation is done in other way, or YANG instance identifier is unnecessary
+     * (e.g. notifications, RPCs).
      *
      * @param path Binding Path in conceptual data tree, for which writer should
      *            be instantiated
@@ -68,9 +66,8 @@ public interface BindingNormalizedNodeWriterFactory {
             @Nonnull NormalizedNodeStreamWriter domWriter);
 
     /**
-     * Creates a {@link BindingStreamEventWriter} for RPC data which will
-     * translate to NormalizedNode model and invoke proper events on supplied
-     * {@link NormalizedNodeStreamWriter}.
+     * Creates a {@link BindingStreamEventWriter} for RPC data which will translate to NormalizedNode model and invoke
+     * proper events on supplied {@link NormalizedNodeStreamWriter}.
      *
      * @param rpcInputOrOutput Binding class representing RPC input or output,
      *            for which writer should be instantiated
@@ -84,9 +81,8 @@ public interface BindingNormalizedNodeWriterFactory {
             @Nonnull NormalizedNodeStreamWriter domWriter);
 
     /**
-     * Creates a {@link BindingStreamEventWriter} for notification which will
-     * translate to NormalizedNode model and invoke proper events on supplied
-     * {@link NormalizedNodeStreamWriter}.
+     * Creates a {@link BindingStreamEventWriter} for notification which will translate to NormalizedNode model
+     * and invoke proper events on supplied {@link NormalizedNodeStreamWriter}.
      *
      * @param notification Binding class representing notification,
      *            for which writer should be instantiated
index ec34733c96db97eed22f5cbc260aa61f1b65cdb4..f6f37d5518aa6ed5d09a403d808e5230f0db620e 100644 (file)
@@ -12,11 +12,10 @@ package org.opendaylight.mdsal.binding.dom.codec.gen.impl;
  */
 abstract class AbstractGenerator {
     /**
-     * Ensure that the serializer class for specified class is loaded
-     * and return its name.
+     * Ensure that the serializer class for specified class is loaded and return its name.
      *
      * @param cls Data object class
      * @return Serializer class name
      */
-    protected abstract String loadSerializerFor(final Class<?> cls);
+    protected abstract String loadSerializerFor(Class<?> cls);
 }
\ No newline at end of file
index cec1eb00edc53eb3b44d41909b7a5ddb2f4cd403..b54256c1a50059907df43b70548fa729c22b273b 100644 (file)
@@ -60,15 +60,15 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
          * fix the static declared fields to final once we initialize them. If we
          * cannot get access, that's fine, too.
          */
-        Field f = null;
+        Field field = null;
         try {
-            f = Field.class.getDeclaredField("modifiers");
-            f.setAccessible(true);
+            field = Field.class.getDeclaredField("modifiers");
+            field.setAccessible(true);
         } catch (NoSuchFieldException | SecurityException e) {
             LOG.warn("Could not get Field modifiers field, serializers run at decreased efficiency", e);
         }
 
-        FIELD_MODIFIERS = f;
+        FIELD_MODIFIERS = field;
     }
 
     protected AbstractStreamWriterGenerator(final JavassistUtils utils) {
@@ -97,7 +97,8 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
         return implementations.getUnchecked(cls).getClass().getName();
     }
 
-    private final class SerializerImplementationLoader extends CacheLoader<Class<?>, DataObjectSerializerImplementation> {
+    private final class SerializerImplementationLoader
+            extends CacheLoader<Class<?>, DataObjectSerializerImplementation> {
 
         private static final String GETINSTANCE_METHOD_NAME = "getInstance";
         private static final String SERIALIZER_SUFFIX = "$StreamWriter";
@@ -110,7 +111,8 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
         @SuppressWarnings("unchecked")
         public DataObjectSerializerImplementation load(final Class<?> type) throws Exception {
             Preconditions.checkArgument(BindingReflections.isBindingClass(type));
-            Preconditions.checkArgument(DataContainer.class.isAssignableFrom(type),"DataContainer is not assingnable from %s from classloader %s.",type,type.getClassLoader());
+            Preconditions.checkArgument(DataContainer.class.isAssignableFrom(type),
+                "DataContainer is not assingnable from %s from classloader %s.", type, type.getClassLoader());
 
             final String serializerName = getSerializerName(type);
 
@@ -129,11 +131,14 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
         }
 
         private Class<? extends DataObjectSerializerImplementation> generateSerializer(final Class<?> type,
-                final String serializerName) throws CannotCompileException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
+                final String serializerName) throws CannotCompileException, IllegalAccessException,
+                IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException,
+                NoSuchFieldException {
             final DataObjectSerializerSource source = generateEmitterSource(type, serializerName);
             final CtClass poolClass = generateEmitter0(type, source, serializerName);
             @SuppressWarnings("unchecked")
-            final Class<? extends DataObjectSerializerImplementation> cls = poolClass.toClass(type.getClassLoader(), type.getProtectionDomain());
+            final Class<? extends DataObjectSerializerImplementation> cls = poolClass.toClass(type.getClassLoader(),
+                type.getProtectionDomain());
 
             /*
              * Due to OSGi class loader rules we cannot initialize the fields during
@@ -165,18 +170,18 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
         final DataObjectSerializerSource source;
         if (schema instanceof ContainerSchemaNode) {
             source = generateContainerSerializer(generatedType, (ContainerSchemaNode) schema);
-        } else if (schema instanceof ListSchemaNode){
+        } else if (schema instanceof ListSchemaNode) {
             final ListSchemaNode casted = (ListSchemaNode) schema;
             if (casted.getKeyDefinition().isEmpty()) {
                 source = generateUnkeyedListEntrySerializer(generatedType, casted);
             } else {
                 source = generateMapEntrySerializer(generatedType, casted);
             }
-        } else if(schema instanceof AugmentationSchema) {
+        } else if (schema instanceof AugmentationSchema) {
             source = generateSerializer(generatedType,(AugmentationSchema) schema);
-        } else if(schema instanceof ChoiceCaseNode) {
+        } else if (schema instanceof ChoiceCaseNode) {
             source = generateCaseSerializer(generatedType,(ChoiceCaseNode) schema);
-        } else if(schema instanceof NotificationDefinition) {
+        } else if (schema instanceof NotificationDefinition) {
             source = generateNotificationSerializer(generatedType,(NotificationDefinition) schema);
         } else {
             throw new UnsupportedOperationException("Schema type " + schema.getClass() + " is not supported");
@@ -184,7 +189,8 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
         return source;
     }
 
-    private CtClass generateEmitter0(final Class<?> type, final DataObjectSerializerSource source, final String serializerName) {
+    private CtClass generateEmitter0(final Class<?> type, final DataObjectSerializerSource source,
+            final String serializerName) {
         final CtClass product;
 
         /*
@@ -199,21 +205,22 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
             (Supplier<String>) () -> source.getSerializerBody().toString());
 
         try {
-            product = javassist.instantiatePrototype(DataObjectSerializerPrototype.class.getName(), serializerName, cls -> {
-                // Generate any static fields
-                for (final StaticConstantDefinition def : source.getStaticConstants()) {
-                    final CtField field = new CtField(javassist.asCtClass(def.getType()), def.getName(), cls);
-                    field.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
-                    cls.addField(field);
-                }
-
-                // Replace serialize() -- may reference static fields
-                final CtMethod serializeTo = cls.getDeclaredMethod(SERIALIZE_METHOD_NAME, serializeArguments);
-                serializeTo.setBody(body);
-
-                // The prototype is not visible, so we need to take care of that
-                cls.setModifiers(Modifier.setPublic(cls.getModifiers()));
-            });
+            product = javassist.instantiatePrototype(DataObjectSerializerPrototype.class.getName(), serializerName,
+                cls -> {
+                    // Generate any static fields
+                    for (final StaticConstantDefinition def : source.getStaticConstants()) {
+                        final CtField field = new CtField(javassist.asCtClass(def.getType()), def.getName(), cls);
+                        field.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
+                        cls.addField(field);
+                    }
+
+                    // Replace serialize() -- may reference static fields
+                    final CtMethod serializeTo = cls.getDeclaredMethod(SERIALIZE_METHOD_NAME, serializeArguments);
+                    serializeTo.setBody(body);
+
+                    // The prototype is not visible, so we need to take care of that
+                    cls.setModifiers(Modifier.setPublic(cls.getModifiers()));
+                });
         } catch (final NotFoundException e) {
             LOG.error("Failed to instatiate serializer {}", source, e);
             throw new LinkageError("Unexpected instantation problem: serializer prototype not found", e);
@@ -222,26 +229,25 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
     }
 
     /**
-     * Generates serializer source code for supplied container node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source code for supplied container node, which will read supplied binding type and invoke
+     * proper methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of container
      * @param node Schema of container
      * @return Source for container node writer
      */
-    protected abstract DataObjectSerializerSource generateContainerSerializer(GeneratedType type, ContainerSchemaNode node);
+    protected abstract DataObjectSerializerSource generateContainerSerializer(GeneratedType type,
+            ContainerSchemaNode node);
 
     /**
-     * Generates serializer source for supplied case node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source for supplied case node, which will read supplied binding type and invoke proper
+     * methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of case
      * @param node Schema of case
@@ -250,12 +256,11 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
     protected abstract DataObjectSerializerSource generateCaseSerializer(GeneratedType type, ChoiceCaseNode node);
 
     /**
-     * Generates serializer source for supplied list node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source for supplied list node, which will read supplied binding type and invoke proper
+     * methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of list
      * @param node Schema of list
@@ -264,26 +269,25 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
     protected abstract DataObjectSerializerSource generateMapEntrySerializer(GeneratedType type, ListSchemaNode node);
 
     /**
-     * Generates serializer source for supplied list node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source for supplied list node, which will read supplied binding type and invoke proper
+     * methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of list
      * @param node Schema of list
      * @return Source for list node writer
      */
-    protected abstract DataObjectSerializerSource generateUnkeyedListEntrySerializer(GeneratedType type, ListSchemaNode node);
+    protected abstract DataObjectSerializerSource generateUnkeyedListEntrySerializer(GeneratedType type,
+            ListSchemaNode node);
 
     /**
-     * Generates serializer source for supplied augmentation node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source for supplied augmentation node, which will read supplied binding type and invoke
+     * proper methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of augmentation
      * @param schema Schema of augmentation
@@ -292,17 +296,16 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement
     protected abstract DataObjectSerializerSource generateSerializer(GeneratedType type, AugmentationSchema schema);
 
     /**
-     * Generates serializer source for notification node,
-     * which will read supplied binding type and invoke proper methods
-     * on supplied {@link BindingStreamEventWriter}.
+     * Generates serializer source for notification node, which will read supplied binding type and invoke proper
+     * methods on supplied {@link BindingStreamEventWriter}.
+     *
      * <p>
-     * Implementation is required to recursively invoke events
-     * for all reachable binding objects.
+     * Implementation is required to recursively invoke events for all reachable binding objects.
      *
      * @param type Binding type of notification
      * @param node Schema of notification
      * @return Source for notification node writer
      */
-    protected abstract DataObjectSerializerSource generateNotificationSerializer(GeneratedType type, NotificationDefinition node);
-
+    protected abstract DataObjectSerializerSource generateNotificationSerializer(GeneratedType type,
+            NotificationDefinition node);
 }
index e3bee8dd3f9b3d3c3c77a011129c687fcd8f688f..03bf419f0e6742a139811506baa7c1041bb2eff5 100644 (file)
@@ -14,18 +14,19 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 abstract class AugmentableDataNodeContainerEmitterSource extends DataNodeContainerSerializerSource {
     private static final String AUGMENTABLE_SERIALIZER = "AUGMENTABLE_SERIALIZER";
 
-    public AugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator, final GeneratedType type, final DataNodeContainer node) {
+    AugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator, final GeneratedType type,
+            final DataNodeContainer node) {
         super(generator, type, node);
         /*
-         * Eventhough intuition says the serializer could reference the generator directly,
-         * that is not true in OSGi environment -- so we need to resolve the reference first
-         * and inject it as a static constant.
+         * Eventhough intuition says the serializer could reference the generator directly, that is not true in OSGi
+         * environment -- so we need to resolve the reference first and inject it as a static constant.
          */
-        staticConstant(AUGMENTABLE_SERIALIZER, DataObjectSerializerImplementation.class, StreamWriterGenerator.AUGMENTABLE);
+        staticConstant(AUGMENTABLE_SERIALIZER, DataObjectSerializerImplementation.class,
+            StreamWriterGenerator.AUGMENTABLE);
     }
 
     @Override
-    protected void emitAfterBody(final StringBuilder b) {
-        b.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));
+    protected void emitAfterBody(final StringBuilder sb) {
+        sb.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));
     }
 }
\ No newline at end of file
index 8ef687dd330e37b1ae86ea9213c318e08f7e52a5..03141587e96cb8f841d87043e5617b0e1776b4cf 100644 (file)
@@ -47,7 +47,8 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
     protected final DataNodeContainer schemaNode;
     private final GeneratedType dtoType;
 
-    DataNodeContainerSerializerSource(final AbstractGenerator generator, final GeneratedType type, final DataNodeContainer node) {
+    DataNodeContainerSerializerSource(final AbstractGenerator generator, final GeneratedType type,
+            final DataNodeContainer node) {
         super(generator);
         this.dtoType = Preconditions.checkNotNull(type);
         this.schemaNode = Preconditions.checkNotNull(node);
@@ -62,35 +63,36 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
 
     @Override
     protected CharSequence getSerializerBody() {
-        final StringBuilder b = new StringBuilder();
-        b.append("{\n");
-        b.append(statement(assign(DataObjectSerializerRegistry.class.getName(), REGISTRY, "$1")));
-        b.append(statement(assign(dtoType.getFullyQualifiedName(), INPUT,
+        final StringBuilder sb = new StringBuilder();
+        sb.append("{\n");
+        sb.append(statement(assign(DataObjectSerializerRegistry.class.getName(), REGISTRY, "$1")));
+        sb.append(statement(assign(dtoType.getFullyQualifiedName(), INPUT,
                 cast(dtoType.getFullyQualifiedName(), "$2"))));
-        b.append(statement(assign(BindingStreamEventWriter.class.getName(), STREAM, cast(BindingStreamEventWriter.class.getName(), "$3"))));
-        b.append(statement(assign(BindingSerializer.class.getName(), SERIALIZER, null)));
-        b.append("if (");
-        b.append(STREAM);
-        b.append(" instanceof ");
-        b.append(BindingSerializer.class.getName());
-        b.append(") {");
-        b.append(statement(assign(SERIALIZER, cast(BindingSerializer.class.getName(), STREAM))));
-        b.append('}');
-        b.append(statement(emitStartEvent()));
-
-        emitBody(b);
-        emitAfterBody(b);
-        b.append(statement(endNode()));
-        b.append(statement("return null"));
-        b.append('}');
-        return b;
+        sb.append(statement(assign(BindingStreamEventWriter.class.getName(), STREAM,
+            cast(BindingStreamEventWriter.class.getName(), "$3"))));
+        sb.append(statement(assign(BindingSerializer.class.getName(), SERIALIZER, null)));
+        sb.append("if (");
+        sb.append(STREAM);
+        sb.append(" instanceof ");
+        sb.append(BindingSerializer.class.getName());
+        sb.append(") {");
+        sb.append(statement(assign(SERIALIZER, cast(BindingSerializer.class.getName(), STREAM))));
+        sb.append('}');
+        sb.append(statement(emitStartEvent()));
+
+        emitBody(sb);
+        emitAfterBody(sb);
+        sb.append(statement(endNode()));
+        sb.append(statement("return null"));
+        sb.append('}');
+        return sb;
     }
 
     /**
      * Allows for customization of emitting code, which is processed after
      * normal DataNodeContainer body. Ideal for augmentations or others.
      */
-    protected void emitAfterBody(final StringBuilder b) {
+    protected void emitAfterBody(final StringBuilder sb) {
         // No-op
     }
 
@@ -123,7 +125,7 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
         return prefix + BindingMapping.getGetterSuffix(node.getQName());
     }
 
-    private void emitBody(final StringBuilder b) {
+    private void emitBody(final StringBuilder sb) {
         final Map<String, Type> getterToType = collectAllProperties(dtoType, new HashMap<String, Type>());
         for (final DataSchemaNode schemaChild : schemaNode.getChildNodes()) {
             if (!schemaChild.isAugmenting()) {
@@ -133,8 +135,9 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
                     // FIXME AnyXml nodes are ignored, since their type cannot be found in generated bindnig
                     // Bug-706 https://bugs.opendaylight.org/show_bug.cgi?id=706
                     if (schemaChild instanceof AnyXmlSchemaNode) {
-                        LOG.warn("Node {} will be ignored. AnyXml is not yet supported from binding aware code." +
-                                "Binding Independent code can be used to serialize anyXml nodes.", schemaChild.getPath());
+                        LOG.warn("Node {} will be ignored. AnyXml is not yet supported from binding aware code."
+                                + "Binding Independent code can be used to serialize anyXml nodes.",
+                                schemaChild.getPath());
                         continue;
                     }
 
@@ -142,26 +145,26 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
                         String.format("Unable to find type for child node %s. Expected child nodes: %s",
                             schemaChild.getPath(), getterToType));
                 }
-                emitChild(b, getter, childType, schemaChild);
+                emitChild(sb, getter, childType, schemaChild);
             }
         }
     }
 
-    private void emitChild(final StringBuilder b, final String getterName, final Type childType,
+    private void emitChild(final StringBuilder sb, final String getterName, final Type childType,
             final DataSchemaNode schemaChild) {
-        b.append(statement(assign(childType, getterName, cast(childType, invoke(INPUT, getterName)))));
+        sb.append(statement(assign(childType, getterName, cast(childType, invoke(INPUT, getterName)))));
 
-        b.append("if (").append(getterName).append(" != null) {\n");
-        emitChildInner(b, getterName, childType, schemaChild);
-        b.append("}\n");
+        sb.append("if (").append(getterName).append(" != null) {\n");
+        emitChildInner(sb, getterName, childType, schemaChild);
+        sb.append("}\n");
     }
 
-    private void emitChildInner(final StringBuilder b, final String getterName, final Type childType,
+    private void emitChildInner(final StringBuilder sb, final String getterName, final Type childType,
             final DataSchemaNode child) {
         if (child instanceof LeafSchemaNode) {
-            b.append(statement(leafNode(child.getQName().getLocalName(), getterName)));
+            sb.append(statement(leafNode(child.getQName().getLocalName(), getterName)));
         } else if (child instanceof AnyXmlSchemaNode) {
-            b.append(statement(anyxmlNode(child.getQName().getLocalName(), getterName)));
+            sb.append(statement(anyxmlNode(child.getQName().getLocalName(), getterName)));
         } else if (child instanceof LeafListSchemaNode) {
             final CharSequence startEvent;
             if (((LeafListSchemaNode) child).isUserOrdered()) {
@@ -169,26 +172,28 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
             } else {
                 startEvent = startLeafSet(child.getQName().getLocalName(),invoke(getterName, "size"));
             }
-            b.append(statement(startEvent));
+            sb.append(statement(startEvent));
             final Type valueType = ((ParameterizedType) childType).getActualTypeArguments()[0];
-            b.append(forEach(getterName, valueType, statement(leafSetEntryNode(CURRENT))));
-            b.append(statement(endNode()));
+            sb.append(forEach(getterName, valueType, statement(leafSetEntryNode(CURRENT))));
+            sb.append(statement(endNode()));
         } else if (child instanceof ListSchemaNode) {
             final Type valueType = ((ParameterizedType) childType).getActualTypeArguments()[0];
             final ListSchemaNode casted = (ListSchemaNode) child;
-            emitList(b, getterName, valueType, casted);
+            emitList(sb, getterName, valueType, casted);
         } else if (child instanceof ContainerSchemaNode) {
-            b.append(tryToUseCacheElse(getterName,statement(staticInvokeEmitter(childType, getterName))));
+            sb.append(tryToUseCacheElse(getterName,statement(staticInvokeEmitter(childType, getterName))));
         } else if (child instanceof ChoiceSchemaNode) {
             final String propertyName = CHOICE_PREFIX + childType.getName();
-            staticConstant(propertyName, DataObjectSerializerImplementation.class, ChoiceDispatchSerializer.from(loadClass(childType)));
-            b.append(tryToUseCacheElse(getterName,statement(invoke(propertyName, StreamWriterGenerator.SERIALIZE_METHOD_NAME, REGISTRY, cast(DataObject.class.getName(),getterName), STREAM))));
+            staticConstant(propertyName, DataObjectSerializerImplementation.class,
+                ChoiceDispatchSerializer.from(loadClass(childType)));
+            sb.append(tryToUseCacheElse(getterName,statement(invoke(propertyName,
+                StreamWriterGenerator.SERIALIZE_METHOD_NAME, REGISTRY, cast(DataObject.class.getName(), getterName),
+                STREAM))));
         }
     }
 
     private static StringBuilder tryToUseCacheElse(final String getterName, final CharSequence statement) {
         final StringBuilder b = new StringBuilder();
-
         b.append("if ( ");
         b.append(SERIALIZER).append("== null || ");
         b.append(invoke(SERIALIZER, "serialize", getterName)).append("== null");
@@ -198,11 +203,11 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
         return b;
     }
 
-    private void emitList(final StringBuilder b, final String getterName, final Type valueType,
+    private void emitList(final StringBuilder sb, final String getterName, final Type valueType,
             final ListSchemaNode child) {
         final CharSequence startEvent;
 
-        b.append(statement(assign("int", "_count", invoke(getterName, "size"))));
+        sb.append(statement(assign("int", "_count", invoke(getterName, "size"))));
         if (child.getKeyDefinition().isEmpty()) {
             startEvent = startUnkeyedList(classReference(valueType), "_count");
         } else if (child.isUserOrdered()) {
@@ -210,8 +215,9 @@ abstract class DataNodeContainerSerializerSource extends DataObjectSerializerSou
         } else {
             startEvent = startMapNode(classReference(valueType), "_count");
         }
-        b.append(statement(startEvent));
-        b.append(forEach(getterName, valueType, tryToUseCacheElse(CURRENT,statement(staticInvokeEmitter(valueType, CURRENT)))));
-        b.append(statement(endNode()));
+        sb.append(statement(startEvent));
+        sb.append(forEach(getterName, valueType, tryToUseCacheElse(CURRENT, statement(staticInvokeEmitter(valueType,
+            CURRENT)))));
+        sb.append(statement(endNode()));
     }
 }
index fc7ec5a3954591bde7923232bedc633079e5ea8d..a3cd64164481a0496af9a7817dbdea71fa60d49f 100644 (file)
@@ -14,8 +14,8 @@ import org.opendaylight.yangtools.yang.binding.DataObjectSerializerRegistry;
 
 /**
  * Prototype of a DataObjectSerializerImplementation. This is a template class, which the
- * {@link AbstractStreamWriterGenerator} uses to instantiate {@link DataObjectSerializerImplementation}
- * on a per-type basis. During that time, the {@link #serialize(DataObjectSerializerRegistry, DataObject, BindingStreamEventWriter)}
+ * {@link AbstractStreamWriterGenerator} uses to instantiate {@link DataObjectSerializerImplementation} on a per-type
+ * basis. During that time, the {@link #serialize(DataObjectSerializerRegistry, DataObject, BindingStreamEventWriter)}
  * method will be replaced by the real implementation.
  */
 final class DataObjectSerializerPrototype implements DataObjectSerializerImplementation {
@@ -35,7 +35,8 @@ final class DataObjectSerializerPrototype implements DataObjectSerializerImpleme
     }
 
     @Override
-    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj, final BindingStreamEventWriter stream) {
+    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj,
+            final BindingStreamEventWriter stream) {
         throw new UnsupportedOperationException("Prototype body, this code should never be invoked.");
     }
 }
index 145cbf99d16a2ee3feef5750a3218ff1ff02ccb0..9d3a0309d3154974ffc7a12e1721c3ca2931ce40 100644 (file)
@@ -30,6 +30,8 @@ abstract class DataObjectSerializerSource extends AbstractSource {
     private final AbstractGenerator generator;
 
     /**
+     * Create a new source.
+     *
      * @param generator Parent generator
      */
     DataObjectSerializerSource(final AbstractGenerator generator) {
index a37827c08fcb8ca91cd8a0789a862c08ba22f86f..835f1c9648fe851d8683cc8a030c58d928144a1d 100644 (file)
@@ -22,15 +22,14 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
 
 /**
- * Concrete implementation of {@link AbstractStreamWriterGenerator}
- * which in runtime generates classes implementing {@link DataObjectSerializerImplementation}
- * interface and are used to serialize Binding {@link DataObject}.
+ * Concrete implementation of {@link AbstractStreamWriterGenerator} which in runtime generates classes implementing
+ * {@link DataObjectSerializerImplementation} interface and are used to serialize Binding {@link DataObject}.
  *
- * Actual implementation of codecs is done via static methods, which allows
- * for static wiring of codecs. Choice codec and Augmentable codecs
- * are static properties of parent codec and stateless implementations
- * are used ( {@link ChoiceDispatchSerializer}, {@link AugmentableDispatchSerializer},
- * which uses registry to dispatch to concrete item codec.
+ * <p>
+ * Actual implementation of codecs is done via static methods, which allows for static wiring of codecs. Choice codec
+ * and Augmentable codecs are static properties of parent codec and stateless implementations are used
+ * ({@link ChoiceDispatchSerializer}, {@link AugmentableDispatchSerializer}), which uses registry to dispatch to
+ * concrete item codec.
  */
 public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     private static final String UNKNOWN_SIZE = BindingStreamEventWriter.class.getName() + ".UNKNOWN_SIZE";
@@ -54,8 +53,8 @@ public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     }
 
     @Override
-    protected DataObjectSerializerSource generateContainerSerializer(final GeneratedType type, final ContainerSchemaNode node) {
-
+    protected DataObjectSerializerSource generateContainerSerializer(final GeneratedType type,
+            final ContainerSchemaNode node) {
         return new AugmentableDataNodeContainerEmitterSource(this, type, node) {
             @Override
             public CharSequence emitStartEvent() {
@@ -65,8 +64,8 @@ public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     }
 
     @Override
-    protected DataObjectSerializerSource generateNotificationSerializer(final GeneratedType type, final NotificationDefinition node) {
-
+    protected DataObjectSerializerSource generateNotificationSerializer(final GeneratedType type,
+            final NotificationDefinition node) {
         return new AugmentableDataNodeContainerEmitterSource(this, type, node) {
             @Override
             public CharSequence emitStartEvent() {
@@ -86,9 +85,9 @@ public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     }
 
     @Override
-    protected DataObjectSerializerSource generateUnkeyedListEntrySerializer(final GeneratedType type, final ListSchemaNode node) {
+    protected DataObjectSerializerSource generateUnkeyedListEntrySerializer(final GeneratedType type,
+            final ListSchemaNode node) {
         return new AugmentableDataNodeContainerEmitterSource(this, type, node) {
-
             @Override
             public CharSequence emitStartEvent() {
                 return startUnkeyedListItem(UNKNOWN_SIZE);
@@ -97,9 +96,9 @@ public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     }
 
     @Override
-    protected DataObjectSerializerSource generateSerializer(final GeneratedType type, final AugmentationSchema schema) {
+    protected DataObjectSerializerSource generateSerializer(final GeneratedType type,
+            final AugmentationSchema schema) {
         return new DataNodeContainerSerializerSource(this, type, schema) {
-
             @Override
             public CharSequence emitStartEvent() {
                 return startAugmentationNode(classReference(type));
@@ -108,7 +107,8 @@ public final class StreamWriterGenerator extends AbstractStreamWriterGenerator {
     }
 
     @Override
-    protected DataObjectSerializerSource generateMapEntrySerializer(final GeneratedType type, final ListSchemaNode node) {
+    protected DataObjectSerializerSource generateMapEntrySerializer(final GeneratedType type,
+            final ListSchemaNode node) {
         return new AugmentableDataNodeContainerEmitterSource(this, type, node) {
             @Override
             public CharSequence emitStartEvent() {
index 11a1f914b1c4e5878524d75b863db8d55af8c58d..45b17722391e43ccd9757b44d753fe44e142a865 100644 (file)
@@ -38,7 +38,8 @@ public abstract class AbstractSource {
         return commonInvoke(object, methodName).append(arg).append(')');
     }
 
-    protected static final CharSequence invoke(final CharSequence object, final String methodName, final Object... args) {
+    protected static final CharSequence invoke(final CharSequence object, final String methodName,
+            final Object... args) {
         final StringBuilder sb = commonInvoke(object, methodName);
 
         final UnmodifiableIterator<Object> iterator = Iterators.forArray(args);
@@ -72,6 +73,10 @@ public abstract class AbstractSource {
         return cast(type.getFullyQualifiedName(), value);
     }
 
+    protected static final CharSequence cast(final String type, final CharSequence value) {
+        return "((" + type + ") " + value + ')';
+    }
+
     protected static final CharSequence forEach(final String iterable, final String iteratorName,
             final String valueType, final String valueName, final CharSequence body) {
         final StringBuilder sb = new StringBuilder();
@@ -85,8 +90,4 @@ public abstract class AbstractSource {
     protected static final CharSequence statement(final CharSequence statement) {
         return new StringBuilder(statement).append(";\n");
     }
-
-    protected static final CharSequence cast(final String type, final CharSequence value) {
-        return "((" + type + ") " + value + ')';
-    }
 }
index 16de7ad4c9458c55fa9a1f8b77e66f27d6a5efd1..951635e2c7848781a2790efd68735f41b01599b1 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.mdsal.binding.dom.codec.gen.spi;
 import com.google.common.base.Preconditions;
 
 /**
- * Definition of static property for generated class
+ * Definition of static property for generated class.
+ *
  * <p>
  * This definition consists of
  * <ul>
@@ -68,5 +69,4 @@ public class StaticConstantDefinition {
         }
         return true;
     }
-
 }
index 4f756cea8baea7bab2bc4be31d0861998269f0b9..fa5dc674aa32e3eea6ce4d7d4d4c08e74cd956dd 100644 (file)
@@ -15,22 +15,18 @@ import java.util.Set;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
- *
- * Abstract Holder of Binding to Normalized Node caches indexed by {@link DataContainerCodecContext}
- * to which cache is associated.
- *
+ * Abstract Holder of Binding to Normalized Node caches indexed by {@link DataContainerCodecContext} to which cache is
+ * associated.
  */
 abstract class AbstractBindingNormalizedNodeCacheHolder {
 
     private final Set<Class<? extends DataObject>> cachedValues;
     private final LoadingCache<DataContainerCodecContext<?, ?>, BindingNormalizedNodeCache> caches = CacheBuilder
             .newBuilder().build(new CacheLoader<DataContainerCodecContext<?, ?>, BindingNormalizedNodeCache>() {
-
                 @Override
-                public BindingNormalizedNodeCache load(final DataContainerCodecContext<?, ?> key) throws Exception {
+                public BindingNormalizedNodeCache load(final DataContainerCodecContext<?, ?> key) {
                     return new BindingNormalizedNodeCache(AbstractBindingNormalizedNodeCacheHolder.this, key);
                 }
-
             });
 
     protected AbstractBindingNormalizedNodeCacheHolder(final Set<Class<? extends DataObject>> cacheSpec) {
index 499d10b951ecf77e09bd0ad03bdc8fbd422ef0fa..273a5e8f53621278f2ee9cd3637e234d577cf5a6 100644 (file)
@@ -14,9 +14,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 
-final class AugmentationNodeContext<D extends DataObject & Augmentation<?>> extends DataObjectCodecContext<D,AugmentationSchema> {
+final class AugmentationNodeContext<D extends DataObject & Augmentation<?>>
+        extends DataObjectCodecContext<D, AugmentationSchema> {
 
-    public AugmentationNodeContext(final DataContainerCodecPrototype<AugmentationSchema> prototype) {
+    AugmentationNodeContext(final DataContainerCodecPrototype<AugmentationSchema> prototype) {
         super(prototype);
     }
 
index afd20911688eff6e9577fc145452045fa40d1044..a3b4333ab73965eb3bbeab67ed8eb072bdf7a2d0 100644 (file)
@@ -125,7 +125,7 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
         DataContainerCodecContext<?,?> currentNode = root;
         for (final InstanceIdentifier.PathArgument bindingArg : binding.getPathArguments()) {
             currentNode = currentNode.bindingPathArgumentChild(bindingArg, builder);
-            Preconditions.checkArgument(currentNode != null, "Supplied Instance Identifier %s is not valid.",binding);
+            Preconditions.checkArgument(currentNode != null, "Supplied Instance Identifier %s is not valid.", binding);
         }
         return currentNode;
     }
@@ -148,7 +148,8 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
         ListNodeCodecContext<?> currentList = null;
 
         for (final YangInstanceIdentifier.PathArgument domArg : dom.getPathArguments()) {
-            Preconditions.checkArgument(currentNode instanceof DataContainerCodecContext<?,?>, "Unexpected child of non-container node %s", currentNode);
+            Preconditions.checkArgument(currentNode instanceof DataContainerCodecContext<?,?>,
+                "Unexpected child of non-container node %s", currentNode);
             final DataContainerCodecContext<?,?> previous = (DataContainerCodecContext<?,?>) currentNode;
             final NodeCodecContext<?> nextNode = previous.yangPathArgumentChild(domArg);
 
@@ -161,7 +162,8 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
              * Identifier as Item or IdentifiableItem
              */
             if (currentList != null) {
-                Preconditions.checkArgument(currentList == nextNode, "List should be referenced two times in YANG Instance Identifier %s", dom);
+                Preconditions.checkArgument(currentList == nextNode,
+                        "List should be referenced two times in YANG Instance Identifier %s", dom);
 
                 // We entered list, so now we have all information to emit
                 // list path using second list argument.
@@ -229,8 +231,8 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
         return getLeafNodesUsingReflection(parentClass, getterToLeafSchema);
     }
 
-    private static String getGetterName(final QName qName, final TypeDefinition<?> typeDef) {
-        final String suffix = BindingMapping.getGetterSuffix(qName);
+    private static String getGetterName(final QName qname, final TypeDefinition<?> typeDef) {
+        final String suffix = BindingMapping.getGetterSuffix(qname);
         if (typeDef instanceof BooleanTypeDefinition || typeDef instanceof EmptyTypeDefinition) {
             return "is" + suffix;
         }
@@ -257,7 +259,8 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
                         throw new IllegalStateException("Unexpected return type " + genericType);
                     }
                 } else {
-                    continue; // We do not have schema for leaf, so we will ignore it (eg. getClass, getImplementedInterface).
+                    // We do not have schema for leaf, so we will ignore it (eg. getClass, getImplementedInterface).
+                    continue;
                 }
                 final Codec<Object, Object> codec = getCodec(valueType, schema);
                 final LeafNodeCodecContext<?> leafNode = new LeafNodeCodecContext<>(schema, codec, method,
@@ -293,13 +296,15 @@ final class BindingCodecContext implements CodecContextFactory, BindingCodecTree
         return ValueTypeCodec.NOOP_CODEC;
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private Codec<Object, Object> getCodecForBindingClass(final Class<?> valueType, final TypeDefinition<?> typeDef) {
         if (typeDef instanceof IdentityrefTypeDefinition) {
             return ValueTypeCodec.encapsulatedValueCodecFor(valueType, identityCodec);
         } else if (typeDef instanceof InstanceIdentifierTypeDefinition) {
             return ValueTypeCodec.encapsulatedValueCodecFor(valueType, instanceIdentifierCodec);
         } else if (typeDef instanceof UnionTypeDefinition) {
-            final Callable<UnionTypeCodec> loader = UnionTypeCodec.loader(valueType, (UnionTypeDefinition) typeDef, this);
+            final Callable<UnionTypeCodec> loader = UnionTypeCodec.loader(valueType, (UnionTypeDefinition) typeDef,
+                this);
             try {
                 return loader.call();
             } catch (final Exception e) {
index 76fb7bcfcd8508c075b9b2ba5a63ec4935e78ee0..dc30e1243cc8768f9d0acb1e49cb87c0ebcf50ac 100644 (file)
@@ -21,7 +21,7 @@ final class BindingNormalizedNodeCache extends CacheLoader<DataObject, Normalize
     final DataContainerCodecContext<?, ?> subtreeRoot;
     final AbstractBindingNormalizedNodeCacheHolder cacheHolder;
 
-    public BindingNormalizedNodeCache(final AbstractBindingNormalizedNodeCacheHolder cacheHolder,
+    BindingNormalizedNodeCache(final AbstractBindingNormalizedNodeCacheHolder cacheHolder,
             final DataContainerCodecContext<?, ?> subtreeRoot) {
         this.cacheHolder = Preconditions.checkNotNull(cacheHolder, "cacheHolder");
         this.subtreeRoot = Preconditions.checkNotNull(subtreeRoot, "subtreeRoot");
@@ -33,9 +33,8 @@ final class BindingNormalizedNodeCache extends CacheLoader<DataObject, Normalize
     }
 
     /**
-     * Returns cached NormalizedNode representation of DataObject.
-     *
-     * If representation is not cached, serializes DataObject and updates cache with representation.
+     * Returns cached NormalizedNode representation of DataObject. If the representation is not cached, serializes
+     * DataObject and updates cache with representation.
      *
      * @param obj Binding object to be deserialized
      * @return NormalizedNode representation of binding object.
index 1b50ce260993929bbe37361a8f690f21dd50bd7a..efc44e253d2b2380965f984879fb0a01b9b448f4 100644 (file)
@@ -92,13 +92,15 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
     }
 
     @Override
-    public <T extends DataObject> Entry<YangInstanceIdentifier,NormalizedNode<?,?>> toNormalizedNode(final InstanceIdentifier<T> path, final T data) {
+    public <T extends DataObject> Entry<YangInstanceIdentifier, NormalizedNode<?,?>> toNormalizedNode(
+            final InstanceIdentifier<T> path, final T data) {
         final NormalizedNodeResult result = new NormalizedNodeResult();
         // We create DOM stream writer which produces normalized nodes
         final NormalizedNodeStreamWriter domWriter = ImmutableNormalizedNodeStreamWriter.from(result);
 
         // We create Binding Stream Writer which translates from Binding to Normalized Nodes
-        final Entry<YangInstanceIdentifier, BindingStreamEventWriter> writeCtx = codecContext.newWriter(path, domWriter);
+        final Entry<YangInstanceIdentifier, BindingStreamEventWriter> writeCtx = codecContext.newWriter(path,
+            domWriter);
 
         // We get serializer which reads binding data and uses Binding To Normalized Node writer to write result
         try {
@@ -172,7 +174,8 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
     }
 
     @Override
-    public Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(final YangInstanceIdentifier path,
+            final NormalizedNode<?, ?> data) {
         if (!isBindingRepresentable(data)) {
             return null;
         }
@@ -181,7 +184,8 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         final NodeCodecContext<?> codec = codecContext.getCodecContextNode(path, builder);
         if (codec == null) {
             if (data != null) {
-                LOG.warn("Path {} does not have a binding equivalent, should have been caught earlier ({})", path, data.getClass());
+                LOG.warn("Path {} does not have a binding equivalent, should have been caught earlier ({})", path,
+                    data.getClass());
             }
             return null;
         }
@@ -203,13 +207,15 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         return codec.deserialize(data);
     }
 
-   @Override
-    public Entry<YangInstanceIdentifier, BindingStreamEventWriter> newWriterAndIdentifier(final InstanceIdentifier<?> path, final NormalizedNodeStreamWriter domWriter) {
+    @Override
+    public Entry<YangInstanceIdentifier, BindingStreamEventWriter> newWriterAndIdentifier(
+            final InstanceIdentifier<?> path, final NormalizedNodeStreamWriter domWriter) {
         return codecContext.newWriter(path, domWriter);
     }
 
     @Override
-    public BindingStreamEventWriter newWriter(final InstanceIdentifier<?> path, final NormalizedNodeStreamWriter domWriter) {
+    public BindingStreamEventWriter newWriter(final InstanceIdentifier<?> path,
+            final NormalizedNodeStreamWriter domWriter) {
         return codecContext.newWriterWithoutIdentifier(path, domWriter);
     }
 
@@ -225,8 +231,10 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         return codecContext.newRpcWriter(rpcInputOrOutput,streamWriter);
     }
 
-    public <T extends DataObject> Function<Optional<NormalizedNode<?, ?>>, Optional<T>>  deserializeFunction(final InstanceIdentifier<T> path) {
-        final DataObjectCodecContext<?,?> ctx = (DataObjectCodecContext<?,?>) codecContext.getCodecContextNode(path, null);
+    public <T extends DataObject> Function<Optional<NormalizedNode<?, ?>>, Optional<T>>  deserializeFunction(
+            final InstanceIdentifier<T> path) {
+        final DataObjectCodecContext<?,?> ctx = (DataObjectCodecContext<?,?>) codecContext.getCodecContextNode(path,
+            null);
         return new DeserializeFunction<>(ctx);
     }
 
@@ -236,6 +244,7 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public BindingCodecTree create(final SchemaContext context, final Class<?>... bindingClasses) {
         final ModuleInfoBackedContext strategy = ModuleInfoBackedContext.create();
         for (final Class<?> bindingCls : bindingClasses) {
@@ -243,8 +252,7 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
                 strategy.registerModuleInfo(BindingReflections.getModuleInfo(bindingCls));
             } catch (final Exception e) {
                 throw new IllegalStateException(
-                        "Could not create BindingRuntimeContext from class " + bindingCls.getName(),
-                        e);
+                        "Could not create BindingRuntimeContext from class " + bindingCls.getName(), e);
             }
         }
         final BindingRuntimeContext runtimeCtx = BindingRuntimeContext.create(strategy, context);
@@ -277,7 +285,8 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         }
     }
 
-    private final class DataObjectSerializerProxy implements DataObjectSerializer, Delegator<DataObjectSerializerImplementation> {
+    private final class DataObjectSerializerProxy
+            implements DataObjectSerializer, Delegator<DataObjectSerializerImplementation> {
         private final DataObjectSerializerImplementation delegate;
 
         DataObjectSerializerProxy(final DataObjectSerializerImplementation delegate) {
@@ -294,5 +303,4 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
             delegate.serialize(BindingNormalizedNodeCodecRegistry.this, obj, stream);
         }
     }
-
 }
index 2cdeb82de0f8c440a72f7ce98e9b2df88bb1960c..1c5b6eb26a593017b050f1a46f48566342f9092d 100644 (file)
@@ -33,13 +33,15 @@ final class BindingToNormalizedStreamWriter implements BindingStreamEventWriter,
     private final NormalizedNodeStreamWriter delegate;
     private final NodeCodecContext<?> rootNodeSchema;
 
-    BindingToNormalizedStreamWriter(final NodeCodecContext<?> rootNodeSchema, final NormalizedNodeStreamWriter delegate) {
+    BindingToNormalizedStreamWriter(final NodeCodecContext<?> rootNodeSchema,
+            final NormalizedNodeStreamWriter delegate) {
         this.rootNodeSchema = Preconditions.checkNotNull(rootNodeSchema);
         this.delegate = Preconditions.checkNotNull(delegate);
     }
 
-    static BindingToNormalizedStreamWriter create(final NodeCodecContext<?> schema, final NormalizedNodeStreamWriter delegate) {
-            return new BindingToNormalizedStreamWriter(schema, delegate);
+    static BindingToNormalizedStreamWriter create(final NodeCodecContext<?> schema,
+            final NormalizedNodeStreamWriter delegate) {
+        return new BindingToNormalizedStreamWriter(schema, delegate);
     }
 
     private void emitSchema(final Object schema) {
index 267c4df6e5e3cd12fbc43323d83fb7d3eb7ad2b8..68d83e85f56b80d47764b5e5a99dc075f558307f 100644 (file)
@@ -70,19 +70,19 @@ final class BitsCodec extends ReflectionBasedCodec implements SchemaUnawareCodec
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public Object deserialize(final Object input) {
         Preconditions.checkArgument(input instanceof Set);
         @SuppressWarnings("unchecked")
         final Set<String> casted = (Set<String>) input;
 
         /*
-         * We can do this walk based on field set sorted by name,
-         * since constructor arguments in Java Binding are sorted by name.
+         * We can do this walk based on field set sorted by name, since constructor arguments in Java Binding are
+         * sorted by name.
          *
-         * This means we will construct correct array for construction
-         * of bits object.
+         * This means we will construct correct array for construction of bits object.
          */
-        final Boolean args[] = new Boolean[ctorArgs.size()];
+        final Boolean[] args = new Boolean[ctorArgs.size()];
         int currentArg = 0;
         for (String value : ctorArgs) {
             args[currentArg++] = casted.contains(value);
@@ -101,7 +101,7 @@ final class BitsCodec extends ReflectionBasedCodec implements SchemaUnawareCodec
         for (Entry<String, Method> valueGet : getters.entrySet()) {
             final Boolean value;
             try {
-                 value = (Boolean) valueGet.getValue().invoke(input);
+                value = (Boolean) valueGet.getValue().invoke(input);
             } catch (IllegalAccessException | InvocationTargetException e) {
                 throw new IllegalArgumentException("Failed to get bit " + valueGet.getKey(), e);
             }
index c57bb756c56edd4dab273aeeeea00589cf758d8f..d8f08d96b71bea022a01e756e0c286fcc307e823 100644 (file)
@@ -18,12 +18,13 @@ import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
  * Serializer of Binding objects to Normalized Node which uses {@link BindingNormalizedNodeCache} to
  * cache already serialized values.
  *
+ * <p>
  * This serializer implements {@link BindingStreamEventWriter} along with {@link BindingSerializer}.
  *
+ * <p>
  * {@link BindingSerializer} interface is used by generated implementations of
  * {@link org.opendaylight.yangtools.yang.binding.DataObjectSerializer} to provide Binding object
  * for inspection and to prevent streaming of already serialized object.
- *
  */
 final class CachingNormalizedNodeSerializer extends ForwardingBindingStreamEventWriter implements
         BindingSerializer<Object, DataObject> {
@@ -53,10 +54,12 @@ final class CachingNormalizedNodeSerializer extends ForwardingBindingStreamEvent
     /**
      * Serializes input if it is cached, returns null otherwise.
      *
+     * <p>
      * If input is cached it uses {@link NormalizedNodeWriterWithAddChild#addChild(NormalizedNode)}
      * to provide already serialized value to underlying NormalizedNodeWriter in order to reuse
      * value instead of creating new one using Normalized Node stream APIs.
      *
+     * <p>
      * Note that this optional is serialization of child node invoked from
      * {@link org.opendaylight.yangtools.yang.binding.DataObjectSerializer}, which may opt-out from
      * streaming of data when non-null result is returned.
@@ -72,18 +75,6 @@ final class CachingNormalizedNodeSerializer extends ForwardingBindingStreamEvent
         return null;
     }
 
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    private BindingNormalizedNodeCache getCacheSerializer(final Class type) {
-        if (cacheHolder.isCached(type)) {
-            final DataContainerCodecContext<?, ?> currentCtx = (DataContainerCodecContext<?, ?>) delegate.current();
-            if (type.equals(currentCtx.getBindingClass())) {
-                return cacheHolder.getCachingSerializer(currentCtx);
-            }
-            return cacheHolder.getCachingSerializer(currentCtx.streamChild(type));
-        }
-        return null;
-    }
-
     /**
      * Serializes supplied data using stream writer with child cache enabled or using cache directly
      * if cache is avalaible also for supplied Codec node.
@@ -102,6 +93,18 @@ final class CachingNormalizedNodeSerializer extends ForwardingBindingStreamEvent
         return serializeUsingStreamWriter(cacheHolder, subtreeRoot, data);
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private BindingNormalizedNodeCache getCacheSerializer(final Class type) {
+        if (cacheHolder.isCached(type)) {
+            final DataContainerCodecContext<?, ?> currentCtx = (DataContainerCodecContext<?, ?>) delegate.current();
+            if (type.equals(currentCtx.getBindingClass())) {
+                return cacheHolder.getCachingSerializer(currentCtx);
+            }
+            return cacheHolder.getCachingSerializer(currentCtx.streamChild(type));
+        }
+        return null;
+    }
+
     /**
      * Serializes supplied data using stream writer with child cache enabled.
      *
index ac68f6a929a2ff209105249986aeaa0df6979228..9243b8b69e25f6420db773635d59fb99759ca65d 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 
 final class CaseNodeCodecContext<D extends DataObject> extends DataObjectCodecContext<D,ChoiceCaseNode> {
-    public CaseNodeCodecContext(final DataContainerCodecPrototype<ChoiceCaseNode> prototype) {
+    CaseNodeCodecContext(final DataContainerCodecPrototype<ChoiceCaseNode> prototype) {
         super(prototype);
     }
 
@@ -39,8 +39,7 @@ final class CaseNodeCodecContext<D extends DataObject> extends DataObjectCodecCo
     }
 
     @Override
-    public YangInstanceIdentifier.PathArgument serializePathArgument(
-            final PathArgument arg) {
+    public YangInstanceIdentifier.PathArgument serializePathArgument(final PathArgument arg) {
         Preconditions.checkArgument(arg == null);
         return null;
     }
index 8b25e1e8a0a7742bd0759b4316c42e3036ba9509..7e7a821bc84415bb4f5fad34268a1c628e49f4ad 100644 (file)
@@ -40,9 +40,10 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
     private final ImmutableMap<Class<?>, DataContainerCodecPrototype<?>> byClass;
     private final ImmutableMap<Class<?>, DataContainerCodecPrototype<?>> byCaseChildClass;
 
-    public ChoiceNodeCodecContext(final DataContainerCodecPrototype<ChoiceSchemaNode> prototype) {
+    ChoiceNodeCodecContext(final DataContainerCodecPrototype<ChoiceSchemaNode> prototype) {
         super(prototype);
-        final Map<YangInstanceIdentifier.PathArgument, DataContainerCodecPrototype<?>> byYangCaseChildBuilder = new HashMap<>();
+        final Map<YangInstanceIdentifier.PathArgument, DataContainerCodecPrototype<?>> byYangCaseChildBuilder =
+                new HashMap<>();
         final Map<Class<?>, DataContainerCodecPrototype<?>> byClassBuilder = new HashMap<>();
         final Map<Class<?>, DataContainerCodecPrototype<?>> byCaseChildClassBuilder = new HashMap<>();
         final Set<Class<?>> potentialSubstitutions = new HashSet<>();
@@ -64,7 +65,8 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
                 // Updates collection of YANG instance identifier to case
                 for (final DataSchemaNode cazeChild : cazeDef.getSchema().getChildNodes()) {
                     if (cazeChild.isAugmenting()) {
-                        final AugmentationSchema augment = SchemaUtils.findCorrespondingAugment(cazeDef.getSchema(), cazeChild);
+                        final AugmentationSchema augment = SchemaUtils.findCorrespondingAugment(cazeDef.getSchema(),
+                            cazeChild);
                         if (augment != null) {
                             byYangCaseChildBuilder.put(SchemaUtils.getNodeIdentifierForAugmentation(augment), cazeDef);
                             continue;
@@ -89,8 +91,8 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
          * binding specification, that if choice is in grouping schema path location is lost,
          * and users may use incorrect case class using copy builders.
          */
-        for(final Class<?> substitution : potentialSubstitutions) {
-            search: for(final Entry<Class<?>, DataContainerCodecPrototype<?>> real : byClassBuilder.entrySet()) {
+        for (final Class<?> substitution : potentialSubstitutions) {
+            search: for (final Entry<Class<?>, DataContainerCodecPrototype<?>> real : byClassBuilder.entrySet()) {
                 if (BindingReflections.isSubstitutionFor(substitution, real.getKey())) {
                     bySubstitutionBuilder.put(substitution, real.getValue());
                     break search;
@@ -105,18 +107,19 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
 
     @SuppressWarnings("unchecked")
     @Override
-    public <DV extends DataObject> DataContainerCodecContext<DV, ?> streamChild(final Class<DV> childClass) {
+    public <C extends DataObject> DataContainerCodecContext<C, ?> streamChild(final Class<C> childClass) {
         final DataContainerCodecPrototype<?> child = byClass.get(childClass);
-        return (DataContainerCodecContext<DV, ?>) childNonNull(child, childClass, "Supplied class %s is not valid case", childClass).get();
+        return (DataContainerCodecContext<C, ?>) childNonNull(child, childClass, "Supplied class %s is not valid case",
+            childClass).get();
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public <DV extends DataObject> Optional<DataContainerCodecContext<DV, ?>> possibleStreamChild(
-            final Class<DV> childClass) {
+    public <C extends DataObject> Optional<DataContainerCodecContext<C, ?>> possibleStreamChild(
+            final Class<C> childClass) {
         final DataContainerCodecPrototype<?> child = byClass.get(childClass);
         if (child != null) {
-            return Optional.of((DataContainerCodecContext<DV, ?>) child.get());
+            return Optional.of((DataContainerCodecContext<C, ?>) child.get());
         }
         return Optional.absent();
     }
@@ -126,7 +129,8 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
     }
 
     protected DataContainerCodecPrototype<ChoiceCaseNode> loadCase(final Class<?> childClass) {
-        final Optional<ChoiceCaseNode> childSchema = factory().getRuntimeContext().getCaseSchemaDefinition(getSchema(), childClass);
+        final Optional<ChoiceCaseNode> childSchema = factory().getRuntimeContext().getCaseSchemaDefinition(getSchema(),
+            childClass);
         if (childSchema.isPresent()) {
             return DataContainerCodecPrototype.from(childClass, childSchema.get(), factory());
         }
@@ -153,7 +157,8 @@ final class ChoiceNodeCodecContext<D extends DataObject> extends DataContainerCo
     @Nullable
     public D deserialize(final NormalizedNode<?, ?> data) {
         Preconditions.checkArgument(data instanceof ChoiceNode);
-        final NormalizedNodeContainer<?, ?, NormalizedNode<?,?>> casted = (NormalizedNodeContainer<?, ?, NormalizedNode<?,?>>) data;
+        final NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>> casted =
+                (NormalizedNodeContainer<?, ?, NormalizedNode<?, ?>>) data;
         final NormalizedNode<?, ?> first = Iterables.getFirst(casted.getValue(), null);
 
         if (first == null) {
index f5fee90c8ed76537ee5c0c67d0651121ff1e246d..9852e8ac0155b30ef73547d0ae3febceb3dc0a8f 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeCaching
 import org.opendaylight.yangtools.yang.binding.BindingStreamEventWriter;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.DataObjectSerializer;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -56,14 +55,14 @@ abstract class DataContainerCodecContext<D extends DataObject,T> extends NodeCod
     }
 
     /**
-     * Returns nested node context using supplied YANG Instance Identifier
+     * Returns nested node context using supplied YANG Instance Identifier.
      *
      * @param arg Yang Instance Identifier Argument
      * @return Context of child
      * @throws IllegalArgumentException If supplied argument does not represent valid child.
      */
     @Override
-    public abstract NodeCodecContext<?> yangPathArgumentChild(final YangInstanceIdentifier.PathArgument arg);
+    public abstract NodeCodecContext<?> yangPathArgumentChild(YangInstanceIdentifier.PathArgument arg);
 
     /**
      * Returns nested node context using supplied Binding Instance Identifier
@@ -74,23 +73,21 @@ abstract class DataContainerCodecContext<D extends DataObject,T> extends NodeCod
      * @throws IllegalArgumentException If supplied argument does not represent valid child.
      */
     @Override
-    public @Nullable DataContainerCodecContext<?,?> bindingPathArgumentChild(final InstanceIdentifier.PathArgument arg,
+    @Nullable
+    public DataContainerCodecContext<?,?> bindingPathArgumentChild(final PathArgument arg,
             final List<YangInstanceIdentifier.PathArgument> builder) {
         final DataContainerCodecContext<?,?> child = streamChild(arg.getType());
-        if(child != null) {
+        if (child != null) {
             if (builder != null) {
                 child.addYangPathArgument(arg,builder);
             }
             return child;
         }
-        throw new IllegalArgumentException("SUpplied argument is not valid child");
+        throw new IllegalArgumentException("Supplied argument is not valid child");
     }
 
     /**
      * Returns deserialized Binding Path Argument from YANG instance identifier.
-     *
-     * @param domArg
-     * @return
      */
     protected PathArgument getBindingPathArgument(final YangInstanceIdentifier.PathArgument domArg) {
         return bindingArg();
@@ -107,29 +104,26 @@ abstract class DataContainerCodecContext<D extends DataObject,T> extends NodeCod
     }
 
     /**
-     *
-     * Returns child context as if it was walked by
-     * {@link BindingStreamEventWriter}. This means that to enter case, one
+     * Returns child context as if it was walked by {@link BindingStreamEventWriter}. This means that to enter case, one
      * must issue getChild(ChoiceClass).getChild(CaseClass).
      *
-     * @param childClass
+     * @param childClass child class
      * @return Context of child node or null, if supplied class is not subtree child
      * @throws IllegalArgumentException If supplied child class is not valid in specified context.
      */
     @Override
-    public abstract @Nullable <DV extends DataObject> DataContainerCodecContext<DV,?> streamChild(final Class<DV> childClass) throws IllegalArgumentException;
+    public abstract @Nullable <C extends DataObject> DataContainerCodecContext<C, ?> streamChild(Class<C> childClass);
 
     /**
-     *
-     * Returns child context as if it was walked by
-     * {@link BindingStreamEventWriter}. This means that to enter case, one
+     * Returns child context as if it was walked by {@link BindingStreamEventWriter}. This means that to enter case, one
      * must issue getChild(ChoiceClass).getChild(CaseClass).
      *
-     * @param childClass
+     * @param childClass child class
      * @return Context of child or Optional absent is supplied class is not applicable in context.
      */
     @Override
-    public abstract <DV extends DataObject> Optional<DataContainerCodecContext<DV,?>> possibleStreamChild(final Class<DV> childClass);
+    public abstract <C extends DataObject> Optional<DataContainerCodecContext<C,?>> possibleStreamChild(
+            Class<C> childClass);
 
     @Override
     public String toString() {
@@ -139,7 +133,7 @@ abstract class DataContainerCodecContext<D extends DataObject,T> extends NodeCod
     @Override
     public BindingNormalizedNodeCachingCodec<D> createCachingCodec(
             final ImmutableCollection<Class<? extends DataObject>> cacheSpecifier) {
-        if(cacheSpecifier.isEmpty()) {
+        if (cacheSpecifier.isEmpty()) {
             return new NonCachingCodec<>(this);
         }
         return new CachingNormalizedNodeCodec<>(this,ImmutableSet.copyOf(cacheSpecifier));
@@ -181,7 +175,7 @@ abstract class DataContainerCodecContext<D extends DataObject,T> extends NodeCod
     }
 
     DataObjectSerializer eventStreamSerializer() {
-        if(eventStreamSerializer == null) {
+        if (eventStreamSerializer == null) {
             eventStreamSerializer = factory().getEventStreamSerializer(getBindingClass());
         }
         return eventStreamSerializer;
index 5ee1df3daca2ca38d10503d06f89c74dc5502c8b..a60efe7a08a1a267f7bb0553c40a0bc92eb135e6 100644 (file)
@@ -38,8 +38,8 @@ final class DataContainerCodecPrototype<T> implements NodeContextSupplier {
     private volatile DataContainerCodecContext<?,T> instance = null;
 
     @SuppressWarnings({"rawtypes", "unchecked"})
-    private DataContainerCodecPrototype(final Class<?> cls, final YangInstanceIdentifier.PathArgument arg, final T nodeSchema,
-            final CodecContextFactory factory) {
+    private DataContainerCodecPrototype(final Class<?> cls, final YangInstanceIdentifier.PathArgument arg,
+            final T nodeSchema, final CodecContextFactory factory) {
         this.bindingClass = cls;
         this.yangArg = arg;
         this.schema = nodeSchema;
@@ -47,24 +47,24 @@ final class DataContainerCodecPrototype<T> implements NodeContextSupplier {
         this.bindingArg = new InstanceIdentifier.Item(bindingClass);
 
         if (arg instanceof AugmentationIdentifier) {
-            this.namespace = Iterables.getFirst(((AugmentationIdentifier) arg).getPossibleChildNames(), null).getModule();
+            this.namespace = Iterables.getFirst(((AugmentationIdentifier) arg).getPossibleChildNames(), null)
+                    .getModule();
         } else {
             this.namespace = arg.getNodeType().getModule();
         }
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    static <T extends DataSchemaNode> DataContainerCodecPrototype<T> from(final Class<?> cls, final T schema,
-            final CodecContextFactory factory) {
-        return new DataContainerCodecPrototype(cls, NodeIdentifier.create(schema.getQName()), schema, factory);
-    }
-
     static DataContainerCodecPrototype<SchemaContext> rootPrototype(final CodecContextFactory factory) {
         final SchemaContext schema = factory.getRuntimeContext().getSchemaContext();
         final NodeIdentifier arg = NodeIdentifier.create(schema.getQName());
-        return new DataContainerCodecPrototype<SchemaContext>(DataRoot.class, arg, schema, factory);
+        return new DataContainerCodecPrototype<>(DataRoot.class, arg, schema, factory);
     }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    static <T extends DataSchemaNode> DataContainerCodecPrototype<T> from(final Class<?> cls, final T schema,
+            final CodecContextFactory factory) {
+        return new DataContainerCodecPrototype(cls, NodeIdentifier.create(schema.getQName()), schema, factory);
+    }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     static DataContainerCodecPrototype<?> from(final Class<?> augClass, final AugmentationIdentifier arg,
@@ -72,9 +72,10 @@ final class DataContainerCodecPrototype<T> implements NodeContextSupplier {
         return new DataContainerCodecPrototype(augClass, arg, schema, factory);
     }
 
-    static DataContainerCodecPrototype<NotificationDefinition> from(final Class<?> augClass, final NotificationDefinition schema, final CodecContextFactory factory) {
+    static DataContainerCodecPrototype<NotificationDefinition> from(final Class<?> augClass,
+            final NotificationDefinition schema, final CodecContextFactory factory) {
         final PathArgument arg = NodeIdentifier.create(schema.getQName());
-        return new DataContainerCodecPrototype<NotificationDefinition>(augClass,arg, schema, factory);
+        return new DataContainerCodecPrototype<>(augClass,arg, schema, factory);
     }
 
     protected T getSchema() {
index 773ceec08a6b8dc362cf442203e397fedc7082eb..584c3474b22da68638ad5be2b7aff16f14208f11 100644 (file)
@@ -54,7 +54,8 @@ import org.opendaylight.yangtools.yang.model.util.SchemaNodeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeContainer> extends DataContainerCodecContext<D,T> {
+abstract class DataObjectCodecContext<D extends DataObject, T extends DataNodeContainer>
+        extends DataContainerCodecContext<D, T> {
     private static final Logger LOG = LoggerFactory.getLogger(DataObjectCodecContext.class);
     private static final MethodType CONSTRUCTOR_TYPE = MethodType.methodType(void.class, InvocationHandler.class);
     private static final MethodType DATAOBJECT_TYPE = MethodType.methodType(DataObject.class, InvocationHandler.class);
@@ -98,7 +99,7 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
             byYangBuilder.put(childProto.getYangArg(), childProto);
             if (childProto.isChoice()) {
                 final ChoiceNodeCodecContext<?> choice = (ChoiceNodeCodecContext<?>) childProto.get();
-                for(final Class<?> cazeChild : choice.getCaseChildrenClasses()) {
+                for (final Class<?> cazeChild : choice.getCaseChildrenClasses()) {
                     byBindingArgClassBuilder.put(cazeChild, childProto);
                 }
             }
@@ -117,7 +118,8 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
         }
         reloadAllAugmentations();
 
-        final Class<?> proxyClass = Proxy.getProxyClass(getBindingClass().getClassLoader(),  new Class[] { getBindingClass(), AugmentationHolder.class });
+        final Class<?> proxyClass = Proxy.getProxyClass(getBindingClass().getClassLoader(), getBindingClass(),
+            AugmentationHolder.class);
         try {
             proxyConstructor = MethodHandles.publicLookup().findConstructor(proxyClass, CONSTRUCTOR_TYPE)
                     .asType(DATAOBJECT_TYPE);
@@ -138,13 +140,13 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
 
     @SuppressWarnings("unchecked")
     @Override
-    public <DV extends DataObject> DataContainerCodecContext<DV, ?> streamChild(final Class<DV> childClass) {
+    public <C extends DataObject> DataContainerCodecContext<C, ?> streamChild(final Class<C> childClass) {
         final DataContainerCodecPrototype<?> childProto = streamChildPrototype(childClass);
-        return (DataContainerCodecContext<DV, ?>) childNonNull(childProto, childClass, " Child %s is not valid child.",
+        return (DataContainerCodecContext<C, ?>) childNonNull(childProto, childClass, " Child %s is not valid child.",
                 childClass).get();
     }
 
-    private final DataContainerCodecPrototype<?> streamChildPrototype(final Class<?> childClass) {
+    private DataContainerCodecPrototype<?> streamChildPrototype(final Class<?> childClass) {
         final DataContainerCodecPrototype<?> childProto = byStreamClass.get(childClass);
         if (childProto != null) {
             return childProto;
@@ -157,11 +159,11 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
 
     @SuppressWarnings("unchecked")
     @Override
-    public <DV extends DataObject> Optional<DataContainerCodecContext<DV, ?>> possibleStreamChild(
-            final Class<DV> childClass) {
+    public <C extends DataObject> Optional<DataContainerCodecContext<C, ?>> possibleStreamChild(
+            final Class<C> childClass) {
         final DataContainerCodecPrototype<?> childProto = streamChildPrototype(childClass);
         if (childProto != null) {
-            return Optional.<DataContainerCodecContext<DV,?>>of((DataContainerCodecContext<DV,?>) childProto.get());
+            return Optional.of((DataContainerCodecContext<C, ?>) childProto.get());
         }
         return Optional.absent();
     }
@@ -272,7 +274,7 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
     }
 
     @Nullable
-    private final DataContainerCodecPrototype<?> augmentationByClassOrEquivalentClass(@Nonnull final Class<?> childClass) {
+    private DataContainerCodecPrototype<?> augmentationByClassOrEquivalentClass(@Nonnull final Class<?> childClass) {
         final DataContainerCodecPrototype<?> childProto = byStreamAugmented.get(childClass);
         if (childProto != null) {
             return childProto;
@@ -329,6 +331,7 @@ abstract class DataObjectCodecContext<D extends DataObject,T extends DataNodeCon
         }
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     protected final D createBindingProxy(final NormalizedNodeContainer<?, ?, ?> node) {
         try {
             return (D) proxyConstructor.invokeExact((InvocationHandler)new LazyDataObject<>(this, node));
index d52930ec451a0bb5399c3dc3e72623821d813d37..af147d55a7c10c1eac8fff967b94458357ef0ecb 100644 (file)
@@ -59,6 +59,7 @@ final class EncapsulatedValueCodec extends ReflectionBasedCodec implements Schem
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public Object deserialize(final Object input) {
         try {
             return constructor.invokeExact(input);
@@ -69,6 +70,7 @@ final class EncapsulatedValueCodec extends ReflectionBasedCodec implements Schem
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public Object serialize(final Object input) {
         try {
             return getter.invokeExact(input);
index 0fdbceee688ce114d9d9443c44e2ba642d8452fb..63d60bb3770acf85cdd7160bb425a8804c10d43b 100644 (file)
@@ -34,7 +34,7 @@ final class IdentifiableItemCodec implements Codec<NodeIdentifierWithPredicates,
     private final MethodHandle ctorInvoker;
     private final MethodHandle ctor;
 
-    public IdentifiableItemCodec(final ListSchemaNode schema, final Class<? extends Identifier<?>> keyClass,
+    IdentifiableItemCodec(final ListSchemaNode schema, final Class<? extends Identifier<?>> keyClass,
             final Class<?> identifiable, final Map<QName, ValueContext> keyValueContexts) {
         this.schema = schema;
         this.identifiable = identifiable;
@@ -85,6 +85,7 @@ final class IdentifiableItemCodec implements Codec<NodeIdentifierWithPredicates,
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public IdentifiableItem<?, ?> deserialize(final NodeIdentifierWithPredicates input) {
         final Object[] bindingValues = new Object[keysInBindingOrder.size()];
         int offset = 0;
index 49dd8cf96fb9feca371f0c7ba2ef1c5fa5f36754..9d5f25f6a2e46cd5f0dde376a23a4c0045484039 100644 (file)
@@ -11,8 +11,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 /**
- * Thrown where incorrect nesting of data structures was detected
- * and was caused by user.
+ * Thrown where incorrect nesting of data structures was detected and was caused by user.
  */
 public class IncorrectNestingException extends IllegalArgumentException {
 
@@ -27,14 +26,14 @@ public class IncorrectNestingException extends IllegalArgumentException {
     }
 
     public static void check(final boolean check, final String message, final Object... args) {
-        if(!check) {
+        if (!check) {
             throw IncorrectNestingException.create(message, args);
         }
     }
 
     @Nonnull
     public static <V> V checkNonNull(@Nullable final V nullable, final String message, final Object... args) {
-        if(nullable != null) {
+        if (nullable != null) {
             return nullable;
         }
         throw IncorrectNestingException.create(message, args);
index d8cac9d4660d89cc2e022c900d835f30785688e1..da8438980dd1c0d098a905fe0e73c896a6d2737e 100644 (file)
@@ -37,11 +37,11 @@ final class KeyedListNodeCodecContext<D extends DataObject & Identifiable<?>> ex
     }
 
     @Override
-    protected void addYangPathArgument(final InstanceIdentifier.PathArgument arg, final List<YangInstanceIdentifier.PathArgument> builder) {
+    protected void addYangPathArgument(final InstanceIdentifier.PathArgument arg,
+            final List<YangInstanceIdentifier.PathArgument> builder) {
         /*
-         * DOM Instance Identifier for list is always represent by two
-         * entries one for map and one for children. This is also true for
-         * wildcarded instance identifiers
+         * DOM Instance Identifier for list is always represent by two entries one for map and one for children. This
+         * is also true for wildcarded instance identifiers
          */
         if (builder == null) {
             return;
@@ -62,13 +62,12 @@ final class KeyedListNodeCodecContext<D extends DataObject & Identifiable<?>> ex
         if (dom instanceof MapEntryNode && keyGetter.equals(method)) {
             NodeIdentifierWithPredicates identifier = ((MapEntryNode) dom).getIdentifier();
             return codec.deserialize(identifier).getKey();
-        } else {
-            return super.getBindingChildValue(method, dom);
         }
+        return super.getBindingChildValue(method, dom);
     }
 
     @Override
-    protected InstanceIdentifier.PathArgument getBindingPathArgument(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument domArg) {
+    protected InstanceIdentifier.PathArgument getBindingPathArgument(final YangInstanceIdentifier.PathArgument domArg) {
         if (domArg instanceof NodeIdentifierWithPredicates) {
             return codec.deserialize((NodeIdentifierWithPredicates) domArg);
         }
@@ -82,7 +81,7 @@ final class KeyedListNodeCodecContext<D extends DataObject & Identifiable<?>> ex
 
     @Override
     public YangInstanceIdentifier.PathArgument serializePathArgument(final InstanceIdentifier.PathArgument arg) {
-        if(arg instanceof IdentifiableItem) {
+        if (arg instanceof IdentifiableItem) {
             return codec.serialize((IdentifiableItem<?,?>) arg);
         }
         return super.serializePathArgument(arg);
@@ -90,11 +89,9 @@ final class KeyedListNodeCodecContext<D extends DataObject & Identifiable<?>> ex
 
     @Override
     public InstanceIdentifier.PathArgument deserializePathArgument(final YangInstanceIdentifier.PathArgument arg) {
-        if(arg instanceof NodeIdentifierWithPredicates) {
+        if (arg instanceof NodeIdentifierWithPredicates) {
             return codec.deserialize((NodeIdentifierWithPredicates) arg);
         }
         return super.deserializePathArgument(arg);
     }
-
-
 }
index 998f461583ddf223509b2d061aadeed5d57d2ede..bcbce38850caf3f9d1ecbd4818046e992f667f18 100644 (file)
@@ -96,7 +96,7 @@ class LazyDataObject<D extends DataObject> implements InvocationHandler, Augment
                     if (!Arrays.equals((byte[]) thisValue, (byte[]) otherValue)) {
                         return false;
                     }
-                } else if (!Objects.equals(thisValue, otherValue)){
+                } else if (!Objects.equals(thisValue, otherValue)) {
                     return false;
                 }
             }
@@ -116,7 +116,7 @@ class LazyDataObject<D extends DataObject> implements InvocationHandler, Augment
     private static Map<Class<? extends Augmentation<?>>, Augmentation<?>> getAllAugmentations(final Object dataObject) {
         if (dataObject instanceof AugmentationReader) {
             return ((AugmentationReader) dataObject).getAugmentations(dataObject);
-        } else if (dataObject instanceof Augmentable<?>){
+        } else if (dataObject instanceof Augmentable<?>) {
             return BindingReflections.getAugmentations((Augmentable<?>) dataObject);
         }
 
@@ -188,8 +188,8 @@ class LazyDataObject<D extends DataObject> implements InvocationHandler, Augment
         Preconditions.checkNotNull(cls,"Supplied augmentation must not be null.");
 
         @SuppressWarnings({"unchecked","rawtypes"})
-        final Optional<DataContainerCodecContext<?,?>> augCtx= context.possibleStreamChild((Class) cls);
-        if(augCtx.isPresent()) {
+        final Optional<DataContainerCodecContext<?, ?>> augCtx = context.possibleStreamChild((Class) cls);
+        if (augCtx.isPresent()) {
             final Optional<NormalizedNode<?, ?>> augData = data.getChild(augCtx.get().getDomPathArgument());
             if (augData.isPresent()) {
                 return augCtx.get().deserialize(augData.get());
index 93ea3b8b0b9f67b45fa64a1e7697c63a4bb2702e..c075713c8a5551541c72583526f59d9c3e9d7db1 100644 (file)
@@ -66,18 +66,18 @@ final class LeafNodeCodecContext<D extends DataObject> extends NodeCodecContext<
                     return qnameDomValueFromString(codec, schema, (String) defaultValue, schemaContext);
                 }
                 return domValueFromString(codec, type, defaultValue);
-            } else {
-                while (type.getBaseType() != null && type.getDefaultValue() == null) {
-                    type = type.getBaseType();
-                }
+            }
 
-                defaultValue = type.getDefaultValue();
-                if (defaultValue != null) {
-                    if (type instanceof IdentityrefTypeDefinition) {
-                        return qnameDomValueFromString(codec, schema, (String) defaultValue, schemaContext);
-                    }
-                    return domValueFromString(codec, type, defaultValue);
+            while (type.getBaseType() != null && type.getDefaultValue() == null) {
+                type = type.getBaseType();
+            }
+
+            defaultValue = type.getDefaultValue();
+            if (defaultValue != null) {
+                if (type instanceof IdentityrefTypeDefinition) {
+                    return qnameDomValueFromString(codec, schema, (String) defaultValue, schemaContext);
                 }
+                return domValueFromString(codec, type, defaultValue);
             }
         }
         return null;
@@ -96,18 +96,18 @@ final class LeafNodeCodecContext<D extends DataObject> extends NodeCodecContext<
             if (module.getPrefix().equals(defaultValuePrefix)) {
                 qname = QName.create(module.getQNameModule(), defaultValue.substring(prefixEndIndex + 1));
                 return codec.deserialize(qname);
-            } else {
-                Set<ModuleImport> imports = module.getImports();
-                for (ModuleImport moduleImport : imports) {
-                    if (moduleImport.getPrefix().equals(defaultValuePrefix)) {
-                        Module importedModule = schemaContext.findModuleByName(moduleImport.getModuleName(),
-                                moduleImport.getRevision());
-                        qname = QName.create(importedModule.getQNameModule(), defaultValue.substring(prefixEndIndex + 1));
-                        return codec.deserialize(qname);
-                    }
+            }
+
+            Set<ModuleImport> imports = module.getImports();
+            for (ModuleImport moduleImport : imports) {
+                if (moduleImport.getPrefix().equals(defaultValuePrefix)) {
+                    Module importedModule = schemaContext.findModuleByName(moduleImport.getModuleName(),
+                        moduleImport.getRevision());
+                    qname = QName.create(importedModule.getQNameModule(), defaultValue.substring(prefixEndIndex + 1));
+                    return codec.deserialize(qname);
                 }
-                return null;
             }
+            return null;
         }
 
         qname = QName.create(schema.getQName(), defaultValue);
@@ -115,7 +115,7 @@ final class LeafNodeCodecContext<D extends DataObject> extends NodeCodecContext<
     }
 
     private static Object domValueFromString(final Codec<Object, Object> codec, final TypeDefinition<?> type,
-    final Object defaultValue) {
+            final Object defaultValue) {
         TypeDefinitionAwareCodec<?, ?> typeDefAwareCodec = TypeDefinitionAwareCodec.from(type);
         if (typeDefAwareCodec != null) {
             Object castedDefaultValue = typeDefAwareCodec.deserialize((String) defaultValue);
@@ -145,7 +145,7 @@ final class LeafNodeCodecContext<D extends DataObject> extends NodeCodecContext<
         return this;
     }
 
-    final Method getGetter() {
+    Method getGetter() {
         return getter;
     }
 
index 06000db634aac62d3b4fa24586416735a9788e67..d66fd335da2097bd93ff08b96e47f1dbe925bd6d 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.mdsal.binding.dom.codec.impl;
 import com.google.common.base.Preconditions;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -34,18 +34,19 @@ public class MissingSchemaException extends IllegalArgumentException {
     }
 
     static void checkModulePresent(final SchemaContext schemaContext, final QName name) {
-        if(schemaContext.findModuleByNamespaceAndRevision(name.getNamespace(), name.getRevision()) == null) {
-            throw MissingSchemaException.create("Module %s is not present in current schema context.",name.getModule());
+        if (schemaContext.findModuleByNamespaceAndRevision(name.getNamespace(), name.getRevision()) == null) {
+            throw MissingSchemaException.create("Module %s is not present in current schema context.",
+                name.getModule());
         }
     }
 
-    static void checkModulePresent(final SchemaContext schemaContext, final YangInstanceIdentifier.PathArgument child) {
+    static void checkModulePresent(final SchemaContext schemaContext, final PathArgument child) {
         checkModulePresent(schemaContext, extractName(child));
     }
 
     private static QName extractName(final PathArgument child) {
-        if(child instanceof YangInstanceIdentifier.AugmentationIdentifier) {
-            final Set<QName> children = ((YangInstanceIdentifier.AugmentationIdentifier) child).getPossibleChildNames();
+        if (child instanceof AugmentationIdentifier) {
+            final Set<QName> children = ((AugmentationIdentifier) child).getPossibleChildNames();
             Preconditions.checkArgument(!children.isEmpty(),"Augmentation without childs must not be used in data");
             return children.iterator().next();
         }
index 43adf9ef3b048e4de0c3f64e10b3322f20f4d358..366371114180bb5133df87c2b0faa5a2935007d9 100644 (file)
@@ -12,11 +12,10 @@ import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 /**
- * Thrown when Java Binding class was used in data for which codec does not
- * have schema.
+ * Thrown when Java Binding class was used in data for which codec does not have schema.
  *
- * By serialization /  deserialization of this exception {@link #getBindingClass()}
- * will return null.
+ * <p>
+ * By serialization /  deserialization of this exception {@link #getBindingClass()} will return null.
  */
 public class MissingSchemaForClassException extends MissingSchemaException {
 
@@ -44,7 +43,7 @@ public class MissingSchemaForClassException extends MissingSchemaException {
         } else {
             schema = runtimeContext.getSchemaDefinition(bindingClass);
         }
-        if(schema == null) {
+        if (schema == null) {
             throw MissingSchemaForClassException.forClass(bindingClass);
         }
     }
index 9e40fdad373d3df5725a61074883e5a2820578a9..3311ae59de63a11fb1fe65a7e3e6d05cf9267d1c 100644 (file)
@@ -23,40 +23,38 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 
 /**
- * Location specific context for schema nodes, which contains codec specific
- * information to properly serialize / deserialize from Java YANG Binding data
- * to NormalizedNode data.
+ * Location specific context for schema nodes, which contains codec specific information to properly serialize
+ * and deserialize from Java YANG Binding data to NormalizedNode data.
  *
+ * <p>
  * Two core subtypes of codec context are available:
  * <ul>
- * <li>{@link LeafNodeCodecContext} - Context for nodes, which does not contain
- * any nested YANG modeled substructures.</li>
- * <li>{@link DataObjectCodecContext} - Context for nodes, which does contain
- * nested YANG modeled substructures. This context nodes contains context
- * for children nodes.</li>
+ * <li>{@link LeafNodeCodecContext} - Context for nodes, which does not contain any nested YANG modeled substructures.
+ * </li>
+ * <li>{@link DataObjectCodecContext} - Context for nodes, which does contain nested YANG modeled substructures. This
+ * context nodes contains context for children nodes.</li>
  * </ul>
  */
 abstract class NodeCodecContext<D extends DataObject> implements BindingCodecTreeNode<D> {
 
     /**
-     * Returns Yang Instance Identifier Path Argument of current node
+     * Returns Yang Instance Identifier Path Argument of current node.
      *
      * @return DOM Path Argument of node
      */
     protected abstract YangInstanceIdentifier.PathArgument getDomPathArgument();
 
     /**
+     * Immutable factory, which provides access to runtime context, create leaf nodes and provides path argument codecs.
      *
-     * Immutable factory, which provides access to runtime context,
-     * create leaf nodes and provides path argument codecs.
      * <p>
-     * During lifetime of factory all calls for same arguments to method must return
-     * equal result (not necessary same instance of result).
-     *
+     * During lifetime of factory all calls for same arguments to method must return equal result (not necessary same
+     * instance of result).
      */
     protected interface CodecContextFactory {
         /**
          * Returns immutable runtime context associated with this factory.
+         *
          * @return runtime context
          */
         BindingRuntimeContext getRuntimeContext();
@@ -71,7 +69,7 @@ abstract class NodeCodecContext<D extends DataObject> implements BindingCodecTre
         ImmutableMap<String, LeafNodeCodecContext<?>> getLeafNodes(Class<?> type, DataNodeContainer schema);
 
         /**
-         * Returns Path argument codec for list item
+         * Returns Path argument codec for list item.
          *
          * @param type Type of list item
          * @param schema Schema of list item
@@ -84,9 +82,7 @@ abstract class NodeCodecContext<D extends DataObject> implements BindingCodecTre
     }
 
     /**
-     *
-     * Serializes supplied Binding Path Argument
-     * and adds all necessary YANG instance identifiers to supplied list.
+     * Serializes supplied Binding Path Argument and adds all necessary YANG instance identifiers to supplied list.
      *
      * @param arg Binding Path Argument
      * @param builder DOM Path argument.
index f47648d6c0b6b3664eaef53206ec0c80e7f72b21..61d7eecf4137f3b607bbc9bf8c2471d94569b9e5 100644 (file)
@@ -15,9 +15,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
 
-final class NotificationCodecContext<D extends DataObject & Notification> extends DataObjectCodecContext<D,NotificationDefinition> {
+final class NotificationCodecContext<D extends DataObject & Notification>
+        extends DataObjectCodecContext<D, NotificationDefinition> {
 
-    public NotificationCodecContext(final Class<?> key, final NotificationDefinition schema, final CodecContextFactory factory) {
+    NotificationCodecContext(final Class<?> key, final NotificationDefinition schema,
+            final CodecContextFactory factory) {
         super(DataContainerCodecPrototype.from(key, schema, factory));
     }
 
@@ -15,6 +15,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * {@link UnmappedRpcInputCodec} and {@link ContainerNodeCodecContext}, which results in bimorphic invocation in
  * {@link BindingNormalizedNodeCodecRegistry#fromNormalizedNodeRpcData()}.
  *
+ * <p>
  * Without this interface we could end up with megamorphic invocation, as the two implementations cannot share class
  * hierarchy.
  *
index 5dbba2a128849653d8c12a3294b4f0945c2c3c2a..33c7746595fa6a0816e79b980c97d78a3afdff00 100644 (file)
@@ -87,8 +87,9 @@ final class SchemaRootCodecContext<D extends DataObject> extends DataContainerCo
             @Override
             public RpcInputCodec load(final SchemaPath key) {
                 final ContainerSchemaNode schema = SchemaContextUtil.getRpcDataSchema(getSchema(), key);
-                if (schema instanceof EffectiveStatement &&
-                        ((EffectiveStatement) schema).getDeclared().getStatementSource() != StatementSource.DECLARATION) {
+                if (schema instanceof EffectiveStatement
+                        && ((EffectiveStatement) schema).getDeclared().getStatementSource()
+                        != StatementSource.DECLARATION) {
                     // This is an implicitly-defined input or output statement. We do not have a corresponding
                     // data representation, so we hard-wire it to null.
                     return UnmappedRpcInputCodec.getInstance();
@@ -120,7 +121,7 @@ final class SchemaRootCodecContext<D extends DataObject> extends DataContainerCo
      *
      * @param factory
      *            CodecContextFactory
-     * @return
+     * @return A new root node
      */
     static SchemaRootCodecContext<?> create(final CodecContextFactory factory) {
         final DataContainerCodecPrototype<SchemaContext> prototype = DataContainerCodecPrototype.rootPrototype(factory);
@@ -130,38 +131,32 @@ final class SchemaRootCodecContext<D extends DataObject> extends DataContainerCo
 
     @SuppressWarnings("unchecked")
     @Override
-    public <DV extends DataObject> DataContainerCodecContext<DV, ?> streamChild(final Class<DV> childClass)
-            throws IllegalArgumentException {
+    public <C extends DataObject> DataContainerCodecContext<C, ?> streamChild(final Class<C> childClass) {
         /* FIXME: This is still not solved for RPCs
          * TODO: Probably performance wise RPC, Data and Notification loading cache
          *       should be merge for performance resons. Needs microbenchmark to
          *       determine which is faster (keeping them separate or in same cache).
          */
         if (Notification.class.isAssignableFrom(childClass)) {
-            return (DataContainerCodecContext<DV, ?>) getNotification((Class<? extends Notification>)childClass);
+            return (DataContainerCodecContext<C, ?>) getNotification((Class<? extends Notification>)childClass);
         }
-        return (DataContainerCodecContext<DV, ?>) getOrRethrow(childrenByClass,childClass);
+        return (DataContainerCodecContext<C, ?>) getOrRethrow(childrenByClass,childClass);
     }
 
     @Override
-    public <E extends DataObject> Optional<DataContainerCodecContext<E,?>> possibleStreamChild(final Class<E> childClass) {
+    public <C extends DataObject> Optional<DataContainerCodecContext<C, ?>> possibleStreamChild(
+            final Class<C> childClass) {
         throw new UnsupportedOperationException("Not supported");
     }
 
     @Override
     public DataContainerCodecContext<?,?> yangPathArgumentChild(final PathArgument arg) {
-        return getOrRethrow(childrenByQName,arg.getNodeType());
+        return getOrRethrow(childrenByQName, arg.getNodeType());
     }
 
     @Override
     public D deserialize(final NormalizedNode<?, ?> normalizedNode) {
-        throw new UnsupportedOperationException(
-                "Could not create Binding data representation for root");
-    }
-
-
-    ContainerNodeCodecContext<?> getRpc(final Class<? extends DataContainer> rpcInputOrOutput) {
-        return getOrRethrow(rpcDataByClass, rpcInputOrOutput);
+        throw new UnsupportedOperationException("Could not create Binding data representation for root");
     }
 
     NotificationCodecContext<?> getNotification(final Class<? extends Notification> notification) {
@@ -172,13 +167,18 @@ final class SchemaRootCodecContext<D extends DataObject> extends DataContainerCo
         return getOrRethrow(notificationsByPath, notification);
     }
 
+    ContainerNodeCodecContext<?> getRpc(final Class<? extends DataContainer> rpcInputOrOutput) {
+        return getOrRethrow(rpcDataByClass, rpcInputOrOutput);
+    }
+
     RpcInputCodec<?> getRpc(final SchemaPath notification) {
         return getOrRethrow(rpcDataByPath, notification);
     }
 
     private DataContainerCodecContext<?,?> createDataTreeChildContext(final Class<?> key) {
         final QName qname = BindingReflections.findQName(key);
-        final DataSchemaNode childSchema = childNonNull(getSchema().getDataChildByName(qname),key,"%s is not top-level item.",key);
+        final DataSchemaNode childSchema = childNonNull(getSchema().getDataChildByName(qname), key,
+            "%s is not top-level item.", key);
         return DataContainerCodecPrototype.from(key, childSchema, factory()).get();
     }
 
index e4e186899aaa562625b6f720450c7dde022ff5ca..fd971233f58b822626a716a0645abeb49377e82a 100644 (file)
@@ -67,7 +67,7 @@ final class UnionTypeCodec extends ReflectionBasedCodec {
      *            - union values
      * @param subtype
      *            - subtype of union
-     * @throws NoSuchMethodException
+     * @throws NoSuchMethodException when the getter method is not found
      */
     private static void addLeafrefValueCodec(final Class<?> unionCls, final UnionTypeDefinition unionType,
             final BindingCodecContext bindingCodecContext, final Set<UnionValueOptionContext> values,
index 07085f6568d2d3ffd65bf08f457ec8efd660b710..5b1ae9eeb1b4f4c1fdd0321d7d7858d1705914f1 100644 (file)
@@ -26,7 +26,8 @@ final class UnionValueOptionContext {
     private final MethodHandle getter;
     private final MethodHandle unionCtor;
 
-    UnionValueOptionContext(final Class<?> unionType, final Class<?> valueType, final Method getter, final Codec<Object, Object> codec) {
+    UnionValueOptionContext(final Class<?> unionType, final Class<?> valueType, final Method getter,
+            final Codec<Object, Object> codec) {
         this.bindingType = Preconditions.checkNotNull(valueType);
         this.codec = Preconditions.checkNotNull(codec);
 
@@ -50,6 +51,7 @@ final class UnionValueOptionContext {
         return baValue == null ? null : codec.serialize(baValue);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     Object deserializeUnion(final Object input) {
         // Side-step potential exceptions by checking the type if it is available
         if (codec instanceof EncapsulatedValueCodec && !((EncapsulatedValueCodec) codec).canAcceptObject(input)) {
@@ -75,6 +77,7 @@ final class UnionValueOptionContext {
         }
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     Object getValueFrom(final Object input) {
         try {
             return getter.invokeExact(input);
index 6654de2fb545cacd6126c0881b4eba6111c53c41..9c2ae02c397c529adad2aace2ef780c6638fc64b 100644 (file)
@@ -21,17 +21,19 @@ final class ValueContext {
     private final Class<?> identifier;
     private final String getterName;
 
-    ValueContext(final Class<?> identifier, final LeafNodeCodecContext <?>leaf) {
+    ValueContext(final Class<?> identifier, final LeafNodeCodecContext<?> leaf) {
         getterName = leaf.getGetter().getName();
         try {
             getter = MethodHandles.publicLookup().unreflect(identifier.getMethod(getterName)).asType(OBJECT_METHOD);
         } catch (IllegalAccessException | NoSuchMethodException | SecurityException e) {
-            throw new IllegalStateException(String.format("Cannot find method %s in class %s", getterName, identifier), e);
+            throw new IllegalStateException(String.format("Cannot find method %s in class %s", getterName, identifier),
+                e);
         }
         this.identifier = identifier;
         codec = leaf.getValueCodec();
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     Object getAndSerialize(final Object obj) {
         final Object value;
         try {
index 42168b1b51de92ad7920a618aa3834aaa345ff21..2ad7a8ac4f8d9ab7a91bb6bd006ba0c1e9e3d9df 100644 (file)
@@ -23,28 +23,20 @@ import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
  */
 abstract class ValueTypeCodec implements Codec<Object, Object> {
 
-    private static final Cache<Class<?>, SchemaUnawareCodec> staticCodecs = CacheBuilder.newBuilder().weakKeys()
+    private static final Cache<Class<?>, SchemaUnawareCodec> STATIC_CODECS = CacheBuilder.newBuilder().weakKeys()
             .build();
 
-
     /**
-     * Marker interface for codecs, which functionality will not be
-     * affected by schema change (introduction of new YANG modules)
-     * they may have one static instance generated when
-     * first time needed.
-     *
+     * Marker interface for codecs, which functionality will not be affected by schema change (introduction of new YANG
+     * modules) they may have one static instance generated when first time needed.
      */
     interface SchemaUnawareCodec extends Codec<Object,Object> {
 
     }
 
-
     /**
-     *
-     * No-op Codec, Java YANG Binding uses same types as NormalizedNode model
-     * for base YANG types, representing numbers, binary and strings.
-     *
-     *
+     * No-op Codec, Java YANG Binding uses same types as NormalizedNode model for base YANG types, representing numbers,
+     * binary and strings.
      */
     public static final SchemaUnawareCodec NOOP_CODEC = new SchemaUnawareCodec() {
 
@@ -62,19 +54,16 @@ abstract class ValueTypeCodec implements Codec<Object, Object> {
     public static final SchemaUnawareCodec EMPTY_CODEC = new SchemaUnawareCodec() {
 
         @Override
-        public Object serialize(final Object arg0) {
-            // Empty type has null value in NormalizedNode and Composite Node
-            // representation
+        public Object serialize(final Object input) {
+            // Empty type has null value in NormalizedNode and Composite Node representation
             return null;
         }
 
         @Override
-        public Object deserialize(final Object arg0) {
-            /* Empty type has boolean.TRUE representation in Binding-aware world
-            *  otherwise it is null / false.
-            *  So when codec is triggered, empty leaf is present, that means we
-            *  are safe to return true.
-            */
+        public Object deserialize(final Object input) {
+            /* Empty type has boolean.TRUE representation in Binding-aware world otherwise it is null / false.
+             * So when codec is triggered, empty leaf is present, that means we are safe to return true.
+             */
             return Boolean.TRUE;
         }
     };
@@ -89,15 +78,17 @@ abstract class ValueTypeCodec implements Codec<Object, Object> {
         return def instanceof EmptyTypeDefinition ? EMPTY_CODEC : NOOP_CODEC;
     }
 
-    private static SchemaUnawareCodec getCachedSchemaUnawareCodec(final Class<?> typeClz, final Callable<? extends SchemaUnawareCodec> loader) {
+    private static SchemaUnawareCodec getCachedSchemaUnawareCodec(final Class<?> typeClz,
+            final Callable<? extends SchemaUnawareCodec> loader) {
         try {
-            return staticCodecs.get(typeClz, loader);
+            return STATIC_CODECS.get(typeClz, loader);
         } catch (ExecutionException e) {
             throw new IllegalStateException(e);
         }
     }
 
-    private static Callable<? extends SchemaUnawareCodec> getCodecLoader(final Class<?> typeClz, final TypeDefinition<?> def) {
+    private static Callable<? extends SchemaUnawareCodec> getCodecLoader(final Class<?> typeClz,
+            final TypeDefinition<?> def) {
 
         TypeDefinition<?> rootType = def;
         while (rootType.getBaseType() != null) {
index 8a26d9a33932bf579de5911d03e3ee26b2332973..3aa7a924931d04eb1690fa379ceca71022e22ab4 100644 (file)
@@ -67,7 +67,7 @@ public class AugmentableDispatchSerializer implements DataObjectSerializerImplem
          * value, which effectively could be used to remove augmentation
          * from builder / DTO.
          */
-        if(value == null) {
+        if (value == null) {
             return;
         }
         Preconditions.checkArgument(value instanceof DataObject);
index 8b51151e7ab86ed8c3f58fb12a50f52cf62a47ae..faf6dd757b0a17c6de99d08317b0299b0234d9e1 100644 (file)
@@ -11,12 +11,11 @@ import java.util.Map;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 /**
- * Interface which sould be implemented by proxy {@link java.lang.reflect.InvocationHandler}
- * to obtain augmentations from proxy implementations of {@link org.opendaylight.yangtools.yang.binding.Augmentable}
- * object.
+ * Interface which sould be implemented by proxy {@link java.lang.reflect.InvocationHandler} to obtain augmentations
+ * from proxy implementations of {@link org.opendaylight.yangtools.yang.binding.Augmentable} object.
  *
- * If implemented proxy does not implement this interface, its augmentations are not
- * properly serialized / deserialized.
+ * <p>
+ * If implemented proxy does not implement this interface, its augmentations are not properly serialized / deserialized.
  */
 public interface AugmentationReader {
 
index a8d4a55b845f69d9c615efe3b147a1d59c9e8ec1..5734d8e49ce423fe838da691ca5fe9277304e0fd 100644 (file)
@@ -34,9 +34,10 @@ public class ChoiceDispatchSerializer implements DataObjectSerializerImplementat
         return new ChoiceDispatchSerializer(choiceClass);
     }
 
-    @SuppressWarnings("unchecked")
     @Override
-    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj, final BindingStreamEventWriter stream) throws IOException {
+    @SuppressWarnings("unchecked")
+    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj,
+            final BindingStreamEventWriter stream) throws IOException {
         @SuppressWarnings("rawtypes")
         Class cazeClass = obj.getImplementedInterface();
         stream.startChoiceNode(choiceClass, BindingStreamEventWriter.UNKNOWN_SIZE);
index de9c7be48aeffdde2e46cdb6167cb9819851cfb6..4332a3a5a937c7b0817520b888c312d0233083d2 100644 (file)
@@ -51,16 +51,24 @@ public class UnionValueOptionContextTest {
     }
 
     protected static final class TestDataObject1 {
-        public void foo() {}
+        public void foo() {
+
+        }
     }
 
     protected static final class TestDataObject2 {
-        public void foo() {}
+        public void foo() {
+
+        }
     }
 
     public static final class TestUnion {
-        public TestUnion(final TestDataObject1 arg) { }
-        public TestUnion(final TestDataObject2 arg) { }
-    }
+        public TestUnion(final TestDataObject1 arg) {
 
+        }
+
+        public TestUnion(final TestDataObject2 arg) {
+
+        }
+    }
 }
index 2262a08481aee768ee81b88d53aa196a2186074c..d85334906580660f07a385a5d853f06bf1804cce 100644 (file)
@@ -37,11 +37,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
- * This sets of tests are designed in way, that schema context contains models for all
- * augmentations, but backing class loading strategy is not aware of some of the classes, and
- * becames aware of them after codec was used.
+ * This sets of tests are designed in way, that schema context contains models for all augmentations, but backing class
+ * loading strategy is not aware of some of the classes, and becames aware of them after codec was used.
  *
- * Idea of this suite is to test that codecs will work even if situation like this happens.
+ * <p>
+ * The idea of this suite is to test that codecs will work even if situation like this happens.
  */
 public class AugmentationClassDiscoveredAfterCodecTest {
 
index 7772852014a9f7649c9bb76a96962ad7e4eee932..654e80f59681d883487a61bb17d5f8c368e4893e 100644 (file)
@@ -60,7 +60,8 @@ public class AugmentationSubstitutionTest extends AbstractBindingRuntimeTest {
             .build();
         final TopLevelList baTree = new TopLevelListBuilder()
             .setKey(TOP_FOO_KEY)
-            .addAugmentation(TreeComplexUsesAugment.class, new TreeComplexUsesAugmentBuilder(createComplexData()).build())
+            .addAugmentation(TreeComplexUsesAugment.class, new TreeComplexUsesAugmentBuilder(createComplexData())
+                .build())
             .build();
         final NormalizedNode<?, ?> domTreeEntry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, baTree).getValue();
         final NormalizedNode<?, ?> domRpcEntry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, baRpc).getValue();
@@ -71,10 +72,13 @@ public class AugmentationSubstitutionTest extends AbstractBindingRuntimeTest {
     public void copyBuilderWithAugmenationsTest() {
         final TopLevelList manuallyConstructed = new TopLevelListBuilder()
             .setKey(TOP_FOO_KEY)
-            .addAugmentation(TreeComplexUsesAugment.class, new TreeComplexUsesAugmentBuilder(createComplexData()).build())
+            .addAugmentation(TreeComplexUsesAugment.class, new TreeComplexUsesAugmentBuilder(createComplexData())
+                .build())
             .build();
-        final NormalizedNode<?, ?> domTreeEntry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, manuallyConstructed).getValue();
-        final TopLevelList deserialized = registry.deserializeFunction(BA_TOP_LEVEL_LIST).apply(Optional.<NormalizedNode<?, ?>>of(domTreeEntry)).get();
+        final NormalizedNode<?, ?> domTreeEntry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, manuallyConstructed)
+                .getValue();
+        final TopLevelList deserialized = registry.deserializeFunction(BA_TOP_LEVEL_LIST)
+                .apply(Optional.of(domTreeEntry)).get();
         assertEquals(manuallyConstructed, deserialized);
         final TopLevelList copiedFromDeserialized = new TopLevelListBuilder(deserialized).build();
         assertEquals(manuallyConstructed, copiedFromDeserialized);
@@ -82,11 +86,10 @@ public class AugmentationSubstitutionTest extends AbstractBindingRuntimeTest {
 
     private static RpcComplexUsesAugment createComplexData() {
         return new RpcComplexUsesAugmentBuilder()
-        .setContainerWithUses(new ContainerWithUsesBuilder()
-            .setLeafFromGrouping("foo")
-        .build())
-        .setListViaUses(Collections.<ListViaUses>emptyList())
-        .build();
+                .setContainerWithUses(new ContainerWithUsesBuilder()
+                    .setLeafFromGrouping("foo")
+                    .build())
+                .setListViaUses(Collections.<ListViaUses>emptyList())
+                .build();
     }
-
 }
index 3008bdb2a8709d057060b9d70ed64a76ccf44037..1357abe16757990f11c0d32c545b4d08eef4a3fb 100644 (file)
@@ -60,6 +60,6 @@ public class BinaryKeyTest extends AbstractBindingRuntimeTest {
 
     private BinaryList process(final BinaryList binaryList) {
         final NormalizedNode<?, ?> domTreeEntry = registry.toNormalizedNode(instanceIdentifier, binaryList).getValue();
-        return registry.deserializeFunction(instanceIdentifier).apply(Optional.<NormalizedNode<?, ?>>of(domTreeEntry)).get();
+        return registry.deserializeFunction(instanceIdentifier).apply(Optional.of(domTreeEntry)).get();
     }
 }
\ No newline at end of file
index a6b14ca75ab413f94fc2597aac39e10900b16437..cc4145796537db5afd1af2a63b9d1675f35a531f 100644 (file)
@@ -62,8 +62,10 @@ public class EmptyLeafTest extends AbstractBindingRuntimeTest {
             .setKey(TOP_FOO_KEY)
             .setChoiceInList(new EmptyLeafBuilder().setEmptyType(true).build())
             .build();
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> dom = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, withEmptyCase);
-        final Entry<InstanceIdentifier<?>, DataObject> readed = registry.fromNormalizedNode(dom.getKey(),dom.getValue());
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> dom = registry.toNormalizedNode(BA_TOP_LEVEL_LIST,
+            withEmptyCase);
+        final Entry<InstanceIdentifier<?>, DataObject> readed = registry.fromNormalizedNode(dom.getKey(),
+            dom.getValue());
         final ChoiceInList list = ((TopLevelList) readed.getValue()).getChoiceInList();
         assertTrue(list instanceof EmptyLeaf);
         assertTrue(((EmptyLeaf) list).isEmptyType());
index 3d090c3176ce3f31360bb98f5a2d5e4d12b72059..d3b0fd936f16deed4b216330adcd93c4d5740f04 100644 (file)
@@ -45,44 +45,45 @@ public class ExceptionReportingTest {
 
     private static final QName TOP_QNAME = Top.QNAME;
     private static final YangInstanceIdentifier BI_TOP_PATH = YangInstanceIdentifier.builder().node(TOP_QNAME).build();
-    private static final YangInstanceIdentifier BI_TREE_LEAF_ONLY = FULL_CODEC.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY);
+    private static final YangInstanceIdentifier BI_TREE_LEAF_ONLY = FULL_CODEC.toYangInstanceIdentifier(
+        BA_TREE_LEAF_ONLY);
 
-
-    @Test(expected=MissingSchemaException.class)
+    @Test(expected = MissingSchemaException.class)
     public void testDOMTop() {
         CODEC_WITHOUT_TOP.fromYangInstanceIdentifier(BI_TOP_PATH);
     }
 
-    @Test(expected=MissingSchemaException.class)
+    @Test(expected = MissingSchemaException.class)
     public void testDOMAugment() {
         CODEC_WITHOUT_TOP.fromYangInstanceIdentifier(BI_TREE_LEAF_ONLY);
     }
 
-    @Test(expected=MissingSchemaForClassException.class)
+    @Test(expected = MissingSchemaForClassException.class)
     public void testBindingTop() {
         CODEC_WITHOUT_TOP.toYangInstanceIdentifier(BA_TOP_LEVEL_LIST);
     }
 
-    @Test(expected=MissingSchemaForClassException.class)
+    @Test(expected = MissingSchemaForClassException.class)
     public void testBindingAugment() {
         ONLY_TOP_CODEC.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY);
     }
 
-    @Test(expected=IncorrectNestingException.class)
+    @Test(expected = IncorrectNestingException.class)
     public void testBindingSkippedRoot() {
         FULL_CODEC.toYangInstanceIdentifier(InstanceIdentifier.create(TopLevelList.class));
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
-    @Test(expected=IncorrectNestingException.class)
+    @Test(expected = IncorrectNestingException.class)
     public void testBindingIncorrectAugment() {
-        FULL_CODEC.toYangInstanceIdentifier(InstanceIdentifier.create(Top.class).augmentation((Class) TreeComplexUsesAugment.class));
+        FULL_CODEC.toYangInstanceIdentifier(InstanceIdentifier.create(Top.class).augmentation(
+            (Class) TreeComplexUsesAugment.class));
     }
 
-
+    @SuppressWarnings("checkstyle:illegalCatch")
     private static BindingNormalizedNodeCodecRegistry codec(final Class<?>... classes) {
         final ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
-        for(final Class<?> clazz : classes) {
+        for (final Class<?> clazz : classes) {
             YangModuleInfo modInfo;
             try {
                 modInfo = BindingReflections.getModuleInfo(clazz);
@@ -94,9 +95,9 @@ public class ExceptionReportingTest {
         final SchemaContext schema = ctx.tryToCreateSchemaContext().get();
         final BindingRuntimeContext runtimeCtx = BindingRuntimeContext.create(ctx, schema);
         final JavassistUtils utils = JavassistUtils.forClassPool(ClassPool.getDefault());
-        final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(utils));
+        final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(
+            StreamWriterGenerator.create(utils));
         registry.onBindingRuntimeContextUpdated(runtimeCtx);
         return registry;
     }
-
 }
index a2b588233f9fddce87bb7e7f8524d36dd6506219..7106d73e51a3108644091ffa1bfb342ff77b85bf 100644 (file)
@@ -28,8 +28,12 @@ import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
-public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingRuntimeTest{
+public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingRuntimeTest {
     public static final String TOP_LEVEL_LIST_KEY_VALUE = "foo";
 
     private static final TopLevelListKey TOP_FOO_KEY = new TopLevelListKey("foo");
@@ -45,10 +49,11 @@ public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingR
     public static final QName TOP_LEVEL_LIST_KEY = QName.create(TOP_QNAME, "name");
     private static final QName SIMPLE_VALUE_QNAME = QName.create(TreeComplexUsesAugment.QNAME, "simple-value");
 
-    public static final YangInstanceIdentifier BI_TOP_PATH = YangInstanceIdentifier.builder().node(TOP_QNAME).build();
+    public static final YangInstanceIdentifier BI_TOP_PATH = YangInstanceIdentifier.of(TOP_QNAME);
     public static final YangInstanceIdentifier BI_TOP_LEVEL_LIST_PATH = BI_TOP_PATH.node(TOP_LEVEL_LIST_QNAME);
     public static final YangInstanceIdentifier BI_TOP_LEVEL_LIST_1_PATH = BI_TOP_LEVEL_LIST_PATH
-            .node(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY, TOP_LEVEL_LIST_KEY_VALUE));
+            .node(new NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY,
+                TOP_LEVEL_LIST_KEY_VALUE));
 
     private BindingNormalizedNodeCodecRegistry registry;
 
@@ -89,8 +94,8 @@ public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingR
     public void testBindingAwareIIToYangIContainer() {
         final YangInstanceIdentifier yangInstanceIdentifier = registry.toYangInstanceIdentifier(
                 InstanceIdentifier.create(Top.class).child(TopLevelList.class));
-        final YangInstanceIdentifier.PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
-        assertTrue(lastPathArgument instanceof YangInstanceIdentifier.NodeIdentifier);
+        final PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
+        assertTrue(lastPathArgument instanceof NodeIdentifier);
         assertEquals(TopLevelList.QNAME, lastPathArgument.getNodeType());
     }
 
@@ -98,8 +103,8 @@ public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingR
     public void testBindingAwareIIToYangIIWildcard() {
         final YangInstanceIdentifier yangInstanceIdentifier = registry.toYangInstanceIdentifier(
                 InstanceIdentifier.create(Top.class).child(TopLevelList.class));
-        final YangInstanceIdentifier.PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
-        assertTrue(lastPathArgument instanceof YangInstanceIdentifier.NodeIdentifier);
+        final PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
+        assertTrue(lastPathArgument instanceof NodeIdentifier);
         assertEquals(TopLevelList.QNAME, lastPathArgument.getNodeType());
     }
 
@@ -107,22 +112,23 @@ public class InstanceIdentifierSerializeDeserializeTest extends AbstractBindingR
     public void testBindingAwareIIToYangIIListWithKey() {
         final YangInstanceIdentifier yangInstanceIdentifier = registry.toYangInstanceIdentifier(
                 InstanceIdentifier.create(Top.class).child(TopLevelList.class, TOP_FOO_KEY));
-        final YangInstanceIdentifier.PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
-        assertTrue(lastPathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates);
-        assertTrue(((YangInstanceIdentifier.NodeIdentifierWithPredicates) lastPathArgument).getKeyValues().containsValue(TOP_LEVEL_LIST_KEY_VALUE));
+        final PathArgument lastPathArgument = yangInstanceIdentifier.getLastPathArgument();
+        assertTrue(lastPathArgument instanceof NodeIdentifierWithPredicates);
+        assertTrue(((NodeIdentifierWithPredicates) lastPathArgument).getKeyValues().containsValue(
+            TOP_LEVEL_LIST_KEY_VALUE));
         assertEquals(TopLevelList.QNAME, lastPathArgument.getNodeType());
     }
 
     @Test
     public void testBindingAwareIIToYangIIAugmentation() {
-        final YangInstanceIdentifier.PathArgument lastArg = registry.toYangInstanceIdentifier(BA_TREE_COMPLEX_USES).getLastPathArgument();
-        assertTrue(lastArg instanceof YangInstanceIdentifier.AugmentationIdentifier);
+        final PathArgument lastArg = registry.toYangInstanceIdentifier(BA_TREE_COMPLEX_USES).getLastPathArgument();
+        assertTrue(lastArg instanceof AugmentationIdentifier);
     }
 
     @Test
     public void testBindingAwareIIToYangIILeafOnlyAugmentation() {
-        final YangInstanceIdentifier.PathArgument leafOnlyLastArg = registry.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
-        assertTrue(leafOnlyLastArg instanceof YangInstanceIdentifier.AugmentationIdentifier);
-        assertTrue(((YangInstanceIdentifier.AugmentationIdentifier) leafOnlyLastArg).getPossibleChildNames().contains(SIMPLE_VALUE_QNAME));
+        final PathArgument leafOnlyLastArg = registry.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
+        assertTrue(leafOnlyLastArg instanceof AugmentationIdentifier);
+        assertTrue(((AugmentationIdentifier) leafOnlyLastArg).getPossibleChildNames().contains(SIMPLE_VALUE_QNAME));
     }
 }
index 4c447005e95c767b6564a4d3a12d1ac4ca904591..60ada67c49c25572a583e901b5c7100c142abc55 100644 (file)
@@ -52,15 +52,13 @@ public class LeafReferenceTest extends AbstractBindingRuntimeTest {
             .setSimpleTypeRef(10)
             .setSchemaUnawareUnion(new Int32StringUnion("foo"))
             .setSchemaUnawareUnionRef(new Int32StringUnion(10))
-        .build();
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> dom = registry.toNormalizedNode(BA_TOP_LEVEL_LIST, binding);
-        final Entry<InstanceIdentifier<?>, DataObject> readed = registry.fromNormalizedNode(dom.getKey(),dom.getValue());
+            .build();
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> dom = registry.toNormalizedNode(BA_TOP_LEVEL_LIST,
+            binding);
+        final Entry<InstanceIdentifier<?>, DataObject> readed = registry.fromNormalizedNode(dom.getKey(),
+            dom.getValue());
         final TreeComplexLeaves readedAugment = (TreeComplexLeaves) readed.getValue();
 
         assertEquals(binding,readedAugment);
-
     }
-
-
-
 }
index 0d8840d1dd2d36736f4f952a643fef80aa5b6042..b8afc04f50b76014fa1f2ace2a42def2d4be50e5 100644 (file)
@@ -68,7 +68,7 @@ public class LeafrefSerializeDeserializeTest extends AbstractBindingRuntimeTest
         assertNotNull(fromYangInstanceIdentifier);
 
         final InstanceIdentifier<ContInt32> BA_II_CONT = InstanceIdentifier.builder(ContInt32.class).build();
-        final RefUnionInt32 refVal = new RefUnionInt32(5l);
+        final RefUnionInt32 refVal = new RefUnionInt32(5L);
         final ContInt32 data = new ContInt32Builder().setRefUnionInt32(refVal).build();
         final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode =
                 this.registry.toNormalizedNode(BA_II_CONT, data);
index e6052e17e2e4f86f6b820ab3e9428f58e1eb213c..d6fa2b0cc2567ae23f89159e0c8ab5276e9448ae 100644 (file)
@@ -23,12 +23,12 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
 
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import javassist.ClassPool;
 import org.junit.Before;
@@ -69,6 +69,10 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
@@ -85,7 +89,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMa
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedLeafSetNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedMapNodeBuilder;
 
-public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRuntimeTest{
+public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRuntimeTest {
 
     public static final String TOP_LEVEL_LIST_FOO_KEY_VALUE = "foo";
     public static final TopLevelListKey TOP_LEVEL_LIST_FOO_KEY = new TopLevelListKey(TOP_LEVEL_LIST_FOO_KEY_VALUE);
@@ -94,7 +98,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     public static final QName TOP_LEVEL_LIST_QNAME = QName.create(TOP_QNAME, "top-level-list");
     public static final QName TOP_LEVEL_LIST_KEY_QNAME = QName.create(TOP_QNAME, "name");
     public static final QName TOP_LEVEL_LEAF_LIST_QNAME = QName.create(TOP_QNAME, "top-level-leaf-list");
-    public static final QName TOP_LEVEL_ORDERED_LEAF_LIST_QNAME = QName.create(TOP_QNAME, "top-level-ordered-leaf-list");
+    public static final QName TOP_LEVEL_ORDERED_LEAF_LIST_QNAME = QName.create(TOP_QNAME,
+        "top-level-ordered-leaf-list");
     public static final QName NESTED_LIST_QNAME = QName.create(TOP_QNAME, "nested-list");
     public static final QName NESTED_LIST_KEY_QNAME = QName.create(TOP_QNAME, "name");
     public static final QName CHOICE_CONTAINER_QNAME = ChoiceContainer.QNAME;
@@ -114,8 +119,10 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     public static final YangInstanceIdentifier BI_TOP_PATH = YangInstanceIdentifier.of(TOP_QNAME);
     public static final YangInstanceIdentifier BI_TOP_LEVEL_LIST_PATH = BI_TOP_PATH.node(TOP_LEVEL_LIST_QNAME);
     public static final YangInstanceIdentifier BI_TOP_LEVEL_LIST_FOO_PATH = BI_TOP_LEVEL_LIST_PATH
-            .node(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE));
-    public static final YangInstanceIdentifier BI_CHOICE_CONTAINER_PATH = YangInstanceIdentifier.of(CHOICE_CONTAINER_QNAME);
+            .node(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME,
+                TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE));
+    public static final YangInstanceIdentifier BI_CHOICE_CONTAINER_PATH = YangInstanceIdentifier.of(
+        CHOICE_CONTAINER_QNAME);
 
     private BindingNormalizedNodeCodecRegistry registry;
 
@@ -130,8 +137,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
 
     @Test
     public void containerToNormalized() {
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(InstanceIdentifier.create(Top.class), top());
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+            InstanceIdentifier.create(Top.class), top());
         final ContainerNode topNormalized = getEmptyTop();
         assertEquals(topNormalized, entry.getValue());
     }
@@ -139,13 +146,13 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     @Test
     public void containerFromNormalized() {
         final ContainerNode topNormalized = getEmptyTop();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
         assertEquals(top(), entry.getValue());
     }
 
     private static ContainerNode getEmptyTop() {
         return ImmutableContainerNodeBuilder.create()
-                    .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
+                    .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                     .withChild(mapNodeBuilder(TOP_LEVEL_LIST_QNAME).build()).build();
     }
 
@@ -158,13 +165,14 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     public void equalsWithAugment() {
         final ContainerNode topNormalizedWithAugments = getNormalizedTopWithAugments(
             augmentationBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.AugmentationIdentifier(singleton(AGUMENT_STRING_Q)))
+                .withNodeIdentifier(new AugmentationIdentifier(singleton(AGUMENT_STRING_Q)))
                 .withChild(ImmutableNodes.leafNode(AGUMENT_STRING_Q, AUGMENT_STRING_VALUE))
                 .build());
         final ContainerNode topNormalized = getEmptyTop();
 
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH, topNormalizedWithAugments);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH,
+            topNormalizedWithAugments);
 
         // Equals on other with no augmentation should be false
         assertNotEquals(top(), entryWithAugments.getValue());
@@ -184,8 +192,9 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         // Equals on self should be true
         assertEquals(entryWithAugments.getValue(), entryWithAugments.getValue());
 
-        final Top topWithAugmentsDiffValue = topWithAugments(Collections.<Class<? extends Augmentation<Top>>, Augmentation<Top>>
-            singletonMap(Top1.class, new Top1Builder().setAugmentedString("differentValue").build()));
+        final Top topWithAugmentsDiffValue = topWithAugments(
+            Collections.<Class<? extends Augmentation<Top>>, Augmentation<Top>>singletonMap(Top1.class,
+                new Top1Builder().setAugmentedString("differentValue").build()));
         assertNotEquals(topWithAugmentsDiffValue, entryWithAugments.getValue());
         assertNotEquals(entryWithAugments.getValue(), topWithAugmentsDiffValue);
     }
@@ -194,16 +203,16 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     public void equalsWithMultipleAugments() {
         final ContainerNode topNormalizedWithAugments = getNormalizedTopWithAugments(
             augmentationBuilder()
-                .withNodeIdentifier(
-                    new YangInstanceIdentifier.AugmentationIdentifier(singleton(AGUMENT_STRING_Q)))
+                .withNodeIdentifier(new AugmentationIdentifier(singleton(AGUMENT_STRING_Q)))
                 .withChild(ImmutableNodes.leafNode(AGUMENT_STRING_Q, AUGMENT_STRING_VALUE))
                 .build(),
             augmentationBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.AugmentationIdentifier(singleton(AUGMENT_INT_Q)))
+                .withNodeIdentifier(new AugmentationIdentifier(singleton(AUGMENT_INT_Q)))
                 .withChild(ImmutableNodes.leafNode(AUGMENT_INT_Q, AUGMENT_INT_VALUE))
                 .build());
 
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH, topNormalizedWithAugments);
+        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH,
+            topNormalizedWithAugments);
         Map<Class<? extends Augmentation<Top>>, Augmentation<Top>> augments = Maps.newHashMap();
         augments.put(Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build());
         augments.put(Top2.class, new Top2Builder().setAugmentedInt(AUGMENT_INT_VALUE).build());
@@ -222,19 +231,20 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     }
 
     private static ContainerNode getNormalizedTopWithAugments(final AugmentationNode... augChild) {
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
-            builder = ImmutableContainerNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder =
+                ImmutableContainerNodeBuilder.create();
 
         for (AugmentationNode augmentationNode : augChild) {
             builder.withChild(augmentationNode);
         }
-        return builder.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
+        return builder.withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                     .withChild(mapNodeBuilder(TOP_LEVEL_LIST_QNAME).build()).build();
     }
 
-    private static Top topWithAugments(final Map<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augments) {
+    private static Top topWithAugments(
+            final Map<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augments) {
         final TopBuilder topBuilder = new TopBuilder();
-        for (Map.Entry<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augment : augments.entrySet()) {
+        for (Entry<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augment : augments.entrySet()) {
             topBuilder.addAugmentation(augment.getKey(), augment.getValue());
         }
         return topBuilder.setTopLevelList(Collections.<TopLevelList>emptyList()).build();
@@ -242,12 +252,11 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
 
     @Test
     public void listWithKeysToNormalized() {
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(BA_TOP_LEVEL_LIST, topLevelList(TOP_LEVEL_LIST_FOO_KEY));
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST,
+            topLevelList(TOP_LEVEL_LIST_FOO_KEY));
         final MapEntryNode topLevelListNormalized = ImmutableMapEntryNodeBuilder.create()
-                .withNodeIdentifier(
-                        new YangInstanceIdentifier.NodeIdentifierWithPredicates(
-                                TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
+                .withNodeIdentifier(new NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME,
+                    TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .build();
         assertEquals(topLevelListNormalized, entry.getValue());
@@ -256,24 +265,23 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     @Test
     public void listWithKeysFromNormalized() {
         final MapEntryNode topLevelListNormalized = ImmutableMapEntryNodeBuilder.create()
-                .withNodeIdentifier(
-                        new YangInstanceIdentifier.NodeIdentifierWithPredicates(
-                                TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
+                .withNodeIdentifier(new NodeIdentifierWithPredicates(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME,
+                    TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry =
-                registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH, topLevelListNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH,
+            topLevelListNormalized);
         assertEquals(topLevelList(TOP_LEVEL_LIST_FOO_KEY), entry.getValue());
     }
 
     @Test
     public void leafOnlyAugmentationToNormalized() {
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(BA_TREE_LEAF_ONLY, new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build());
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(BA_TREE_LEAF_ONLY,
+            new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build());
         final Set<QName> augmentationChildren = new HashSet<>();
         augmentationChildren.add(SIMPLE_VALUE_QNAME);
         final AugmentationNode augmentationNode = ImmutableAugmentationNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.AugmentationIdentifier(augmentationChildren))
+                .withNodeIdentifier(new AugmentationIdentifier(augmentationChildren))
                 .withChild(leafNode(SIMPLE_VALUE_QNAME, "simpleValue"))
                 .build();
         assertEquals(augmentationNode, entry.getValue());
@@ -284,11 +292,12 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         final Set<QName> augmentationChildren = new HashSet<>();
         augmentationChildren.add(SIMPLE_VALUE_QNAME);
         final AugmentationNode augmentationNode = ImmutableAugmentationNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.AugmentationIdentifier(augmentationChildren))
+                .withNodeIdentifier(new AugmentationIdentifier(augmentationChildren))
                 .withChild(leafNode(SIMPLE_VALUE_QNAME, "simpleValue"))
                 .build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH.node(
-                new YangInstanceIdentifier.AugmentationIdentifier(augmentationChildren)), augmentationNode);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(
+            BI_TOP_LEVEL_LIST_FOO_PATH.node(new AugmentationIdentifier(augmentationChildren)),
+            augmentationNode);
         assertEquals(new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build(), entry.getValue());
     }
 
@@ -298,15 +307,16 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         topLevelLeafList.add("foo");
         Top top = new TopBuilder().setTopLevelOrderedLeafList(topLevelLeafList).build();
 
-        Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
+        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+            InstanceIdentifier.create(Top.class), top);
         ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
+                .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                 .withChild(ImmutableOrderedLeafSetNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
+                        .withNodeIdentifier(new NodeIdentifier(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
                         .withChild(
                                 ImmutableLeafSetEntryNodeBuilder.create()
-                                        .withNodeIdentifier(new YangInstanceIdentifier.NodeWithValue<>(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME, "foo"))
+                                        .withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME,
+                                                "foo"))
                                         .withValue("foo")
                                         .build())
                         .build())
@@ -320,15 +330,15 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         topLevelLeafList.add("foo");
         final Top top = new TopBuilder().setTopLevelLeafList(topLevelLeafList).build();
 
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+            InstanceIdentifier.create(Top.class), top);
         final ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
+                .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                 .withChild(ImmutableLeafSetNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_LEVEL_LEAF_LIST_QNAME))
+                        .withNodeIdentifier(new NodeIdentifier(TOP_LEVEL_LEAF_LIST_QNAME))
                         .withChild(
                                 ImmutableLeafSetEntryNodeBuilder.create()
-                                        .withNodeIdentifier(new YangInstanceIdentifier.NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo"))
+                                        .withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo"))
                                         .withValue("foo")
                                         .build())
                         .build())
@@ -339,12 +349,15 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     @Test
     public void leafListFromNormalized() {
         final ContainerNode topWithLeafList = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
-                .withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_LEVEL_LEAF_LIST_QNAME))
-                        .withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
-                                new YangInstanceIdentifier.NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo")).withValue("foo").build()).build())
+                .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
+                .withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(
+                    TOP_LEVEL_LEAF_LIST_QNAME))
+                    .withChild(ImmutableLeafSetEntryNodeBuilder.create()
+                        .withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo"))
+                        .withValue("foo").build()).build())
                 .build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH,
+            topWithLeafList);
         final List<String> topLevelLeafList = new ArrayList<>();
         topLevelLeafList.add("foo");
         final Top top = new TopBuilder().setTopLevelLeafList(topLevelLeafList).build();
@@ -354,13 +367,14 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
     @Test
     public void orderedLeafListFromNormalized() {
         ContainerNode topWithLeafList = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
-                .withChild(ImmutableOrderedLeafSetNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier
-                        (TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
-                        .withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
-                                new YangInstanceIdentifier.NodeWithValue<>(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME, "foo")).withValue("foo").build()).build())
+                .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
+                .withChild(ImmutableOrderedLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(
+                    TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
+                    .withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
+                        new NodeWithValue<>(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME, "foo")).withValue("foo").build())
+                    .build())
                 .build();
-        Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
+        Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
         List<String> topLevelLeafList = new ArrayList<>();
         topLevelLeafList.add("foo");
         Top top = new TopBuilder().setTopLevelOrderedLeafList(topLevelLeafList).build();
@@ -369,15 +383,17 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
 
     @Test
     public void choiceToNormalized() {
-        final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder().setExtendedId(
-                new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
-                registry.toNormalizedNode(InstanceIdentifier.create(ChoiceContainer.class), choiceContainerBA);
+        final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder()
+            .setExtendedId(new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+            InstanceIdentifier.create(ChoiceContainer.class), choiceContainerBA);
         final ContainerNode choiceContainer = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CHOICE_CONTAINER_QNAME))
-                .withChild(ImmutableChoiceNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CHOICE_IDENTIFIER_QNAME))
-                        .withChild(ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(EXTENDED_ID_QNAME))
-                                .withChild(leafNode(CHOICE_IDENTIFIER_ID_QNAME, "identifier_value")).build()).build())
+                .withNodeIdentifier(new NodeIdentifier(CHOICE_CONTAINER_QNAME))
+                .withChild(ImmutableChoiceNodeBuilder.create()
+                    .withNodeIdentifier(new NodeIdentifier(CHOICE_IDENTIFIER_QNAME))
+                        .withChild(ImmutableContainerNodeBuilder.create()
+                            .withNodeIdentifier(new NodeIdentifier(EXTENDED_ID_QNAME))
+                            .withChild(leafNode(CHOICE_IDENTIFIER_ID_QNAME, "identifier_value")).build()).build())
                 .build();
         assertEquals(choiceContainer, entry.getValue());
     }
@@ -393,39 +409,42 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         final QName nestedContainerLeafOuterQname = QName.create(containerIdentifierQname4798,
                 "leaf-in-outer-container");
 
-        final YangInstanceIdentifier yangInstanceIdentifierOuter = YangInstanceIdentifier.of(containerIdentifierQname4798);
+        final YangInstanceIdentifier yangInstanceIdentifierOuter = YangInstanceIdentifier.of(
+            containerIdentifierQname4798);
         final ContainerNode containerNodeOuter = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(containerIdentifierQname4798))
+                .withNodeIdentifier(new NodeIdentifier(containerIdentifierQname4798))
                 .withChild(ImmutableContainerNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(nestedContainerOuterQname))
+                        .withNodeIdentifier(new NodeIdentifier(nestedContainerOuterQname))
                         .withChild(leafNode(nestedContainerLeafOuterQname, "bar"))
                         .build())
                 .build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entryContainer = registry.fromNormalizedNode
-                 (yangInstanceIdentifierOuter, containerNodeOuter);
+        final Entry<InstanceIdentifier<?>, DataObject> entryContainer = registry.fromNormalizedNode(
+            yangInstanceIdentifierOuter, containerNodeOuter);
         assertNotNull(entryContainer.getValue());
         assertNotNull(entryContainer.getKey());
 
-        final YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates4798 = new YangInstanceIdentifier
-                .NodeIdentifierWithPredicates(nestedListQname4798, nestedListKeyQname4798, "foo");
-        final YangInstanceIdentifier yangInstanceIdentifier4798 = YangInstanceIdentifier.of(containerIdentifierQname4798)
+        final NodeIdentifierWithPredicates nodeIdentifierWithPredicates4798 =
+                new NodeIdentifierWithPredicates(nestedListQname4798, nestedListKeyQname4798, "foo");
+        final YangInstanceIdentifier yangInstanceIdentifier4798 = YangInstanceIdentifier.of(
+            containerIdentifierQname4798)
                 .node(choiceIdentifierQname4798)
                 .node(nestedListQname4798)
                 .node(nodeIdentifierWithPredicates4798);
 
-        final YangInstanceIdentifier yangInstanceIdentifierValid = YangInstanceIdentifier.of(containerIdentifierQname4798)
+        final YangInstanceIdentifier yangInstanceIdentifierValid = YangInstanceIdentifier.of(
+            containerIdentifierQname4798)
                 .node(choiceIdentifierQname4798)
                 .node(nestedContainerValidQname)
                 .node(nestedListQname4798)
                 .node(nodeIdentifierWithPredicates4798);
         final ContainerNode containerNodeValid = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(containerIdentifierQname4798))
+                .withNodeIdentifier(new NodeIdentifier(containerIdentifierQname4798))
                 .withChild(ImmutableChoiceNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(choiceIdentifierQname4798))
+                        .withNodeIdentifier(new NodeIdentifier(choiceIdentifierQname4798))
                         .withChild(ImmutableContainerNodeBuilder.create()
-                                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(nestedContainerValidQname))
-                                .withChild(ImmutableMapNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier
-                                        .NodeIdentifier(nestedListQname4798))
+                                .withNodeIdentifier(new NodeIdentifier(nestedContainerValidQname))
+                                .withChild(ImmutableMapNodeBuilder.create()
+                                    .withNodeIdentifier(new NodeIdentifier(nestedListQname4798))
                                         .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "foo"))
                                         .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "bar"))
                                         .build())
@@ -433,42 +452,45 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
                         .build())
                 .build();
         try {
-            registry.fromNormalizedNode
-                    (yangInstanceIdentifierValid, containerNodeValid);
+            registry.fromNormalizedNode(yangInstanceIdentifierValid, containerNodeValid);
             fail("Incorect YangInstanceIdentifier should fail");
         } catch (IllegalStateException e) {
+            // Expected
         }
 
         final ContainerNode containerNode4798 = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(containerIdentifierQname4798))
+                .withNodeIdentifier(new NodeIdentifier(containerIdentifierQname4798))
                 .withChild(ImmutableChoiceNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(choiceIdentifierQname4798))
-                        .withChild(ImmutableMapNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier
-                                .NodeIdentifier(nestedListQname4798))
-                                .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "foo"))
-                                .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "bar"))
-                                .build())
+                        .withNodeIdentifier(new NodeIdentifier(choiceIdentifierQname4798))
+                        .withChild(ImmutableMapNodeBuilder.create()
+                            .withNodeIdentifier(new NodeIdentifier(nestedListQname4798))
+                            .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "foo"))
+                            .withChild(mapEntry(nestedListQname4798, nestedListKeyQname4798, "bar"))
+                            .build())
                         .build())
                 .build();
         try {
-            registry.fromNormalizedNode
-                    (yangInstanceIdentifier4798, containerNode4798);
+            registry.fromNormalizedNode(yangInstanceIdentifier4798, containerNode4798);
             fail("Incorect YangInstanceIdentifier should fail");
         } catch (IllegalStateException e) {
+            // Expected
         }
     }
 
     @Test
     public void choiceFromNormalized() {
         final ContainerNode choiceContainerBI = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CHOICE_CONTAINER_QNAME))
-                .withChild(ImmutableChoiceNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CHOICE_IDENTIFIER_QNAME))
-                        .withChild(ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(EXTENDED_ID_QNAME))
-                                .withChild(leafNode(CHOICE_IDENTIFIER_ID_QNAME, "identifier_value")).build()).build())
+                .withNodeIdentifier(new NodeIdentifier(CHOICE_CONTAINER_QNAME))
+                .withChild(ImmutableChoiceNodeBuilder.create()
+                    .withNodeIdentifier(new NodeIdentifier(CHOICE_IDENTIFIER_QNAME))
+                    .withChild(ImmutableContainerNodeBuilder.create()
+                        .withNodeIdentifier(new NodeIdentifier(EXTENDED_ID_QNAME))
+                        .withChild(leafNode(CHOICE_IDENTIFIER_ID_QNAME, "identifier_value")).build()).build())
                 .build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_CHOICE_CONTAINER_PATH, choiceContainerBI);
-        final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder().setExtendedId(
-                new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_CHOICE_CONTAINER_PATH,
+            choiceContainerBI);
+        final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder()
+            .setExtendedId(new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
         assertEquals(choiceContainerBA, entry.getValue());
     }
 
@@ -478,32 +500,35 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         final List<NestedList> nestedLists = new ArrayList<>();
         nestedLists.add(new NestedListBuilder().setKey(new NestedListKey("foo")).build());
         nestedLists.add(new NestedListBuilder().setKey(new NestedListKey("bar")).build());
-        final TopLevelList topLevelList = new TopLevelListBuilder().setKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(nestedLists).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(ii, topLevelList);
-        final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+        final TopLevelList topLevelList = new TopLevelListBuilder().setKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(
+            nestedLists).build();
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(ii, topLevelList);
+        final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(new NodeIdentifierWithPredicates(
                 TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
-                .withChild(
-                        ImmutableOrderedMapNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(NESTED_LIST_QNAME))
-                                .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
-                                .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
+                .withChild(ImmutableOrderedMapNodeBuilder.create()
+                    .withNodeIdentifier(new NodeIdentifier(NESTED_LIST_QNAME))
+                    .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
+                    .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
         assertEquals(foo, entry.getValue());
     }
 
     @Test
     public void orderedLisFromNormalized() {
-        final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+        final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(new NodeIdentifierWithPredicates(
                 TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
-                .withChild(
-                        ImmutableOrderedMapNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(NESTED_LIST_QNAME))
-                                .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
-                                .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
-        final Map.Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH, foo);
+                .withChild(ImmutableOrderedMapNodeBuilder.create()
+                    .withNodeIdentifier(new NodeIdentifier(NESTED_LIST_QNAME))
+                    .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
+                    .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
+        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH,
+            foo);
         final List<NestedList> nestedLists = new ArrayList<>();
         nestedLists.add(new NestedListBuilder().setKey(new NestedListKey("foo")).build());
         nestedLists.add(new NestedListBuilder().setKey(new NestedListKey("bar")).build());
-        final TopLevelList topLevelList = new TopLevelListBuilder().setKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(nestedLists).build();
+        final TopLevelList topLevelList = new TopLevelListBuilder().setKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(
+            nestedLists).build();
         assertEquals(topLevelList, entry.getValue());
     }
 
@@ -514,16 +539,11 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
         final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
 
-        final YangInstanceIdentifier.AugmentationIdentifier aug1Id =
-                new YangInstanceIdentifier.AugmentationIdentifier(Sets.newHashSet(augmentChoice1QName));
-        final YangInstanceIdentifier.AugmentationIdentifier aug2Id =
-                new YangInstanceIdentifier.AugmentationIdentifier(Sets.newHashSet(augmentChoice2QName));
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice1Id =
-                new YangInstanceIdentifier.NodeIdentifier(augmentChoice1QName);
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice2Id =
-                new YangInstanceIdentifier.NodeIdentifier(augmentChoice2QName);
-        final YangInstanceIdentifier.NodeIdentifier containerId =
-                new YangInstanceIdentifier.NodeIdentifier(containerQName);
+        final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Collections.singleton(augmentChoice1QName));
+        final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Collections.singleton(augmentChoice2QName));
+        final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
+        final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
+        final NodeIdentifier containerId = new NodeIdentifier(containerQName);
 
         final TopBuilder tBuilder = new TopBuilder();
         final TopChoiceAugment1Builder tca1Builder = new TopChoiceAugment1Builder();
@@ -539,11 +559,11 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         tBuilder.addAugmentation(TopChoiceAugment1.class, tca1Builder.build());
         final Top top = tBuilder.build();
 
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> biResult =
-                registry.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
+        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> biResult = registry.toNormalizedNode(
+            InstanceIdentifier.create(Top.class), top);
 
         final NormalizedNode<?, ?> topNormalized =
-                containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_QNAME))
+                containerBuilder().withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                 .withChild(augmentationBuilder().withNodeIdentifier(aug1Id)
                         .withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id)
                                 .withChild(augmentationBuilder().withNodeIdentifier(aug2Id)
@@ -559,7 +579,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingRunti
         assertEquals(BI_TOP_PATH, biResult.getKey());
         assertEquals(topNormalized, biResult.getValue());
 
-        final Map.Entry<InstanceIdentifier<?>, DataObject> baResult = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> baResult = registry.fromNormalizedNode(BI_TOP_PATH,
+            topNormalized);
 
         assertEquals(InstanceIdentifier.create(Top.class), baResult.getKey());
         assertEquals(top, baResult.getValue());
index 9b4322e2f98efc75e98acd06fdc68f01f090bd6d..02928462aa9436be88f3cd456bf000a5f868a99f 100644 (file)
@@ -52,7 +52,8 @@ public class NotificationProcessingTest extends AbstractBindingRuntimeTest {
         assertNotNull("Serialization must not return null obejct.",dom);
         assertEquals(TwoLevelListChanged.QNAME,dom.getIdentifier().getNodeType());
 
-        final Notification bindingDeserialized = registry.fromNormalizedNodeNotification(SchemaPath.create(true, TwoLevelListChanged.QNAME),dom);
+        final Notification bindingDeserialized = registry.fromNormalizedNodeNotification(SchemaPath.create(true,
+            TwoLevelListChanged.QNAME),dom);
         assertNotNull(bindingDeserialized);
         assertTrue(bindingDeserialized instanceof TwoLevelListChanged);
         assertEquals(bindingOriginal,bindingDeserialized);
index 715786231545e090ae47968978ad71bee5f25a86..f9f7958d90ac6d95e46e773f21194a877ac732b4 100644 (file)
@@ -37,9 +37,10 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableCo
 
 public class UnionTypeTest extends AbstractBindingRuntimeTest {
 
-    private static final String testString = "testtesttest";
+    private static final String TEST_STRING = "testtesttest";
 
-    public static final QName WRAPPER_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:yangtools:test:union", "2015-01-21", "wrapper");
+    public static final QName WRAPPER_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:yangtools:test:union",
+        "2015-01-21", "wrapper");
     public static final QName WRAP_LEAF_QNAME = QName.create(WRAPPER_QNAME, "wrap");
 
     private BindingNormalizedNodeCodecRegistry registry;
@@ -54,13 +55,14 @@ public class UnionTypeTest extends AbstractBindingRuntimeTest {
 
     @Test
     public void unionTest() {
-        TopLevel topLevel = TopLevelBuilder.getDefaultInstance(testString);
+        TopLevel topLevel = TopLevelBuilder.getDefaultInstance(TEST_STRING);
         Wrapper wrapper = new WrapperBuilder().setWrap(topLevel).build();
-        NormalizedNode<?, ?> topLevelEntry = registry.toNormalizedNode(InstanceIdentifier.builder(Wrapper.class).build(), wrapper).getValue();
+        NormalizedNode<?, ?> topLevelEntry = registry.toNormalizedNode(InstanceIdentifier.create(Wrapper.class),
+            wrapper).getValue();
 
         ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(WRAPPER_QNAME))
-                .withChild(ImmutableNodes.leafNode(WRAP_LEAF_QNAME, testString))
+                .withChild(ImmutableNodes.leafNode(WRAP_LEAF_QNAME, TEST_STRING))
                 .build();
         Assert.assertEquals(topLevelEntry, containerNode);
     }
index f9eda43693d7f6b0e237aa06a9309f4493bae3bf..4846fd2a6119b6b7205cd25d8217c4b3296088e8 100644 (file)
@@ -29,8 +29,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class UnionTypeWithIdentityrefTest extends AbstractBindingRuntimeTest {
-    private static final String identOneString = "IdentOne";
-    public static final QName NODE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:mdsal:test:bug:6066", "2016-06-07", "union-node");
+    private static final String IDENT_ONE_STRING = "IdentOne";
+    public static final QName NODE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:mdsal:test:bug:6066",
+        "2016-06-07", "union-node");
     public static final QName NODE_LEAF_QNAME = QName.create(NODE_QNAME, "value");
 
     private BindingNormalizedNodeCodecRegistry registry;
@@ -59,7 +60,7 @@ public class UnionTypeWithIdentityrefTest extends AbstractBindingRuntimeTest {
 
     @Test
     public void bug6006Test() {
-        DataObject unionNodeObj = createValueNode(identOneString);
+        DataObject unionNodeObj = createValueNode(IDENT_ONE_STRING);
         UnionType unionTypeObj = ((UnionNode) unionNodeObj).getValue();
         assertEquals(null, unionTypeObj.getUint8());
         assertEquals(IdentOne.class, unionTypeObj.getIdentityref());