Turn NodeModification into an abstract class 80/13480/3
authorRobert Varga <rovarga@cisco.com>
Tue, 9 Dec 2014 15:46:22 +0000 (16:46 +0100)
committerRobert Varga <rovarga@cisco.com>
Thu, 25 Dec 2014 09:08:34 +0000 (10:08 +0100)
We have a single-implementation case here, plus the interface is
non-public, Turn it into an abstract class to extract the last bit of
performance.

Change-Id: I384ddf7d785d7c323c2ba361c38f4b5a03697a38
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ModifiedNode.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/NodeModification.java

index bc6b46d46f6c05f186b5d9511cf9561bb532bec8..cfece17b886c8616c222790bd7e996d270fc0486 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
  * and {@link StoreMetadataNode} which represents original state {@link #getOriginal()}.
  */
 @NotThreadSafe
-final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<PathArgument>, NodeModification {
+final class ModifiedNode extends NodeModification implements StoreTreeNode<ModifiedNode> {
 
     public static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = new Predicate<ModifiedNode>() {
         @Override
@@ -91,7 +91,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
      * @return original store metadata
      */
     @Override
-    public Optional<TreeNode> getOriginal() {
+    Optional<TreeNode> getOriginal() {
         return original;
     }
 
@@ -101,7 +101,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
      * @return modification type
      */
     @Override
-    public ModificationType getType() {
+    ModificationType getType() {
         return modificationType;
     }
 
@@ -160,7 +160,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
      * @return all recorded direct child modifications
      */
     @Override
-    public Iterable<ModifiedNode> getChildren() {
+    Iterable<ModifiedNode> getChildren() {
         return children.values();
     }
 
index 409a713d4904498f71137802482046486990795c..8e92ff1f22af9a54444033d8af1a18f4f04cdfe6 100644 (file)
@@ -19,13 +19,13 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
  * It is used by the validation code to allow for a read-only view of the
  * modification tree as we should never modify that during validation.
  */
-interface NodeModification extends Identifiable<PathArgument> {
+abstract class NodeModification implements Identifiable<PathArgument> {
     /**
      * Get the type of modification.
      *
      * @return Modification type.
      */
-    ModificationType getType();
+    abstract ModificationType getType();
 
     /**
      * Get the original tree node to which the modification is to be applied.
@@ -33,12 +33,12 @@ interface NodeModification extends Identifiable<PathArgument> {
      * @return The original node, or {@link Optional#absent()} if the node is
      *         a new node.
      */
-    Optional<TreeNode> getOriginal();
+    abstract Optional<TreeNode> getOriginal();
 
     /**
      * Get a read-only view of children nodes.
      *
      * @return Iterable of all children nodes.
      */
-    Iterable<? extends NodeModification> getChildren();
+    abstract Iterable<? extends NodeModification> getChildren();
 }