Sheldon is a dirty checking framework that deep compares two object graphs, detects any changes a reports (complains about) them.
A simple example:
//Just mark the Entity as Auditable
@Auditable(name = "Missy Cooper", comparatorFields = @AuditComparator({ "dnaSeq" }))
public class MissyCooper {
//Used as the identifier of this record, hence added in @AuditComparator on the class
private DnaSequence dnaSeq;
//Adding @AuditField means the field is dirty checked
@AuditField(fieldName = "Last Name", groups = "matrimony")
private String lastName;
//Unlikely to change hence not Audited
private String firstName;
//It works on component objects.
@AuditField(fieldName = "Sibling", comparatorFields = @AuditComparator("iq"), groups = "exceptional")
private SheldonCooper twin;
//Because Missy keeps tabs on Sheldon and tattles to her mom
//This could have been Person, but SheldonCooper is a singleton class with a one of a kind IQ and we are not really sure in and object of SheldonCooper passes the instanceof Person test!
//We don't care about him, so not annotation
private Person brother;
//And on Iterables
@AuditableList(groups = {"standard","mischievous"}, comparatorFields = @AuditComparator("id"))
private List<Child> children = new ArrayList<Child>();
}
Now dirty checking is as simple as
AuditChecker checker = new AuditChecker<MissyCooper>();
//Detects all the changes
List<AuditChangeEntry> changes = checker.checkObjects(oldMissy, newMissy);
//If you only want to detect changes in the group "exceptional"
List<AuditChangeEntry> sheldonyChanges = checker.checkObjects(oldMissy, newMissy, "exceptional");
//If you only want to detect changes in the group "mischievous" and "exceptional"
List<AuditChangeEntry> mischievousChanges = checker.checkObjects(oldMissy, newMissy, "mischievous", "exceptional");
For more information please head to the wiki. A good starting point is the API Overview. If you are curious as to why the project is called Sheldon, there's a page dedicated to just that.
You can also look at the test cases to see how the API is used and the dirty checking results are used.