Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2014 Daniel Bechler
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package de.danielbechler.diff.circular;
Allows to define how the circular reference detector compares object instances. By default it uses the equality operator (`==`) which should be fine in mose cases.

When dealing with object models that return copies of its properties on every access, it's possible to end up in infinite loops, because even though the objects may look the same, they would be different instances. In those cases it is possible to switch the instance detection mode to use the equals method instead of the equality operator. This way objects will be considered to be "the same" whenever `equals` returns `true`.

This configuration interface also allows to register a custom handler for exception thrown, whenever a circular reference is detected. The default handler simply logs a warning.

Daniel Bechler
New to GrepCode? Check out our FAQ X