Make NodeWithValue generic
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / YangInstanceIdentifier.java
index 9944d741e66cd64a99e61c82393646e8c9dae6a3..06760528ea9e33d61589542624dbe672dda69f64 100644 (file)
@@ -575,17 +575,17 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
      * Simple path argument identifying a {@link LeafSetEntryNode} leaf
      * overall data tree.
      */
-    public static final class NodeWithValue extends AbstractPathArgument {
+    public static final class NodeWithValue<T> extends AbstractPathArgument {
         private static final long serialVersionUID = -3637456085341738431L;
 
-        private final Object value;
+        private final T value;
 
-        public NodeWithValue(final QName node, final Object value) {
+        public NodeWithValue(final QName node, final T value) {
             super(node);
             this.value = value;
         }
 
-        public Object getValue() {
+        public T getValue() {
             return value;
         }
 
@@ -593,7 +593,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
         protected int hashCodeImpl() {
             final int prime = 31;
             int result = super.hashCodeImpl();
-            result = prime * result + ((value == null) ? 0 : YangInstanceIdentifier.hashCode(value));
+            result = prime * result + YangInstanceIdentifier.hashCode(value);
             return result;
         }
 
@@ -602,7 +602,7 @@ public abstract class YangInstanceIdentifier implements Path<YangInstanceIdentif
             if (!super.equals(obj)) {
                 return false;
             }
-            final NodeWithValue other = (NodeWithValue) obj;
+            final NodeWithValue<?> other = (NodeWithValue<?>) obj;
             return Objects.deepEquals(value, other.value);
         }