Retaining the type of contained value is useful in various places, which
means we don't have to add an explicit cast.
Change-Id: Ibf3b16fd7b3348730f3efb3e284a345e69003e30
Signed-off-by: Robert Varga <rovarga@cisco.com>
* Simple path argument identifying a {@link LeafSetEntryNode} leaf
* overall data tree.
*/
* 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 static final long serialVersionUID = -3637456085341738431L;
- private final Object value;
- public NodeWithValue(final QName node, final Object value) {
+ public NodeWithValue(final QName node, final T value) {
super(node);
this.value = value;
}
super(node);
this.value = value;
}
- public Object getValue() {
protected int hashCodeImpl() {
final int prime = 31;
int result = super.hashCodeImpl();
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);
if (!super.equals(obj)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
- final NodeWithValue other = (NodeWithValue) obj;
+ final NodeWithValue<?> other = (NodeWithValue<?>) obj;
return Objects.deepEquals(value, other.value);
}
return Objects.deepEquals(value, other.value);
}