Skip to content

Commit

Permalink
ValidationChain: drop use of SchemaTreeEquivalence
Browse files Browse the repository at this point in the history
Signed-off-by: Francis Galiegue <[email protected]>
  • Loading branch information
fge committed May 25, 2014
1 parent f605c5e commit 2d38847
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.github.fge.jsonschema.core.report.ProcessingReport;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.util.ValueHolder;
import com.github.fge.jsonschema.core.util.equivalence.SchemaTreeEquivalence;
import com.github.fge.jsonschema.library.Library;
import com.github.fge.jsonschema.processors.build.ValidatorBuilder;
import com.github.fge.jsonschema.processors.data.SchemaContext;
Expand All @@ -39,6 +38,8 @@
import com.github.fge.jsonschema.processors.format.FormatProcessor;
import com.google.common.base.Equivalence;

import javax.annotation.ParametersAreNonnullByDefault;

/**
* A validation chain
*
Expand Down Expand Up @@ -80,8 +81,7 @@ public ValidationChain(final RefResolver refResolver,
= ProcessorChain.startWith(digester).chainWith(keywordBuilder);

if (cfg.getUseFormat()) {
final FormatProcessor format
= new FormatProcessor(library, cfg);
final FormatProcessor format = new FormatProcessor(library, cfg);
chain2 = chain2.chainWith(format);
}

Expand Down Expand Up @@ -120,26 +120,24 @@ public String toString()
return resolver + " -> " + builder;
}

@ParametersAreNonnullByDefault
private static final class SchemaHolderEquivalence
extends Equivalence<ValueHolder<SchemaTree>>
{
private static final Equivalence<ValueHolder<SchemaTree>> INSTANCE
= new SchemaHolderEquivalence();

private static final Equivalence<SchemaTree> EQUIVALENCE
= SchemaTreeEquivalence.getInstance();

@Override
protected boolean doEquivalent(final ValueHolder<SchemaTree> a,
final ValueHolder<SchemaTree> b)
{
return EQUIVALENCE.equivalent(a.getValue(), b.getValue());
return a.getValue().equals(b.getValue());
}

@Override
protected int doHash(final ValueHolder<SchemaTree> t)
{
return EQUIVALENCE.hash(t.getValue());
return t.getValue().hashCode();
}
}
}

0 comments on commit 2d38847

Please sign in to comment.