Closed ghost closed 8 years ago
sorry, duplicated.
Don't worry about it. Did the other issue give you enough pointers to solve your problem?
Yes it indeed did.
ObjectDifferBuilder.startBuilding().differs().register((differDispatcher, nodeQueryService) -> new ByteArrayDiffer()).build();
private static final class ByteArrayDiffer implements Differ {
@Override
public boolean accepts(Class<?> aClass) {
return byte[].class.equals(aClass);
}
@Override
public DiffNode compare(DiffNode diffNode, Instances instances) {
final DiffNode beanNode = new DiffNode(diffNode, instances.getSourceAccessor(), instances.getType());
if(instances.areNull() || instances.areSame())
beanNode.setState(DiffNode.State.UNTOUCHED);
else if(instances.hasBeenAdded())
beanNode.setState(DiffNode.State.ADDED);
else if(instances.hasBeenRemoved())
beanNode.setState(DiffNode.State.REMOVED);
else
beanNode.setState(DiffNode.State.CHANGED);
return beanNode;
}
}
I just need to check whether it has changed so the code worked like a charm!
Thanks!
On Jan 27, 2016, at 18:17, Daniel Bechler notifications@github.com wrote:
Don't worry about it. Did the other issue give you enough pointers to solve your problem?
— Reply to this email directly or view it on GitHub https://github.com/SQiShER/java-object-diff/issues/152#issuecomment-175834502.
Awesome! :smiley:
Hi, I'm testing your library and found out that if a bean has byte[] it throws IllegalStateException. How can add a proper differ for this object type? I couldn't figure out a way of doing that reading your API. My differ will only base64 and compare the values to check whether has changed or not.
Thanks in advance.