public Equivalence getEquivalence(JsonElement json) {
        Equivalence equivalence;
        String uriString = json.getAsJsonObject().getAsJsonPrimitive(URI).getAsString();
        URI uri;
        try {
            uri = new URI(urlEncode(uriString));
        } catch (Exception e) {
            throw new JsonParseException(String.format(EXCEPTION_MESSAGE, uriString));
        }
        equivalence = new Equivalence(uri);
        JsonArray duplicates = json.getAsJsonObject().getAsJsonArray(DUPLICATES);
        for (int i = 0; i < duplicates.size(); i++) {
            try {
                equivalence.addDuplicate(new URI(urlEncode(duplicates.get(i).getAsString())));
            } catch (Exception e) {
                // if an equivalent URI is not well-formed it's better to do not add it, let's go on
                continue;
            }
        }
        return equivalence;
    }
public Equivalence getEquivalence ( JsonElement json ) { Equivalence equivalence ; String uriString = json . getAsJsonObject ( ) . getAsJsonPrimitive ( URI ) . getAsString ( ) ; URI uri ; try { uri = new URI ( urlEncode ( uriString ) ) ; } catch ( Exception e ) { throw new JsonParseException ( String . format ( EXCEPTION_MESSAGE , uriString ) ) ; } equivalence = new Equivalence ( uri ) ; JsonArray duplicates = json . getAsJsonObject ( ) . getAsJsonArray ( DUPLICATES ) ; for ( int i = 0 ; i < duplicates . size ( ) ; i ++ ) { try { equivalence . addDuplicate ( new URI ( urlEncode ( duplicates . get ( i ) . getAsString ( ) ) ) ) ; } catch ( Exception e ) { continue ; } } return equivalence ; }
Deserialize a single {@link org.nnsoft.sameas4j.Equivalence}
from its Json serialization.

@param json object to be deserialized
@return a not null {@link org.nnsoft.sameas4j.Equivalence} instance