io.edurt.datacap.parser.node.NodeRef Maven / Gradle / Ivy
package io.edurt.datacap.parser.node;
import static java.lang.String.format;
import static java.lang.System.identityHashCode;
import static java.util.Objects.requireNonNull;
public final class NodeRef
{
private final T node;
private NodeRef(T node)
{
this.node = requireNonNull(node, "node is null");
}
public static NodeRef of(T node)
{
return new NodeRef<>(node);
}
public T getNode()
{
return node;
}
@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NodeRef> other = (NodeRef>) o;
return node == other.node;
}
@Override
public int hashCode()
{
return identityHashCode(node);
}
@Override
public String toString()
{
return format(
"@%s: %s",
Integer.toHexString(identityHashCode(node)),
node);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy