com.github.fge.jackson
Class JsonNumEquals

java.lang.Object
  extended by com.google.common.base.Equivalence<JsonNode>
      extended by com.github.fge.jackson.JsonNumEquals

public final class JsonNumEquals
extends Equivalence<JsonNode>

An Equivalence strategy for JSON Schema equality

JsonNode does a pretty good job of obeying the equals()/hashCode() contract. And in fact, it does it too well for JSON Schema.

For instance, it considers numeric nodes 1 and 1.0 to be different nodes, which is true. But some IETF RFCs and drafts (among them, JSON Schema and JSON Patch) mandate that numeric JSON values be considered equal if their mathematical value is the same. This class implements this kind of equality.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.common.base.Equivalence
Equivalence.Wrapper<T>
 
Method Summary
protected  boolean doEquivalent(JsonNode a, JsonNode b)
           
protected  int doHash(JsonNode t)
           
static Equivalence<JsonNode> getInstance()
           
 
Methods inherited from class com.google.common.base.Equivalence
equals, equivalent, equivalentTo, hash, identity, onResultOf, pairwise, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Equivalence<JsonNode> getInstance()

doEquivalent

protected boolean doEquivalent(JsonNode a,
                               JsonNode b)
Specified by:
doEquivalent in class Equivalence<JsonNode>

doHash

protected int doHash(JsonNode t)
Specified by:
doHash in class Equivalence<JsonNode>