title: How to implement equals without exposing fields?
body: <p>Let's say I have a <code>Dog</code> class which has a field <code>private final int age</code> and a method <code>public Dog ageBy(Time time)</code> which returns new Instance of the dog every time invoked. A <code>Dog</code> class is not just immutable but doesn't have any <code>get</code> methods to return it's age, in other words dog's contract doesn't allow him to say his age (why? cause there is no talking dogs), he can only 'bark', 'sleep' and do other dog's stuff. </p>
  
  <p>But <code>Dog</code> can be compared with other dogs by age. To do so I need to override <code>public equals(Object o)</code> method in <code>Dog</code> class. But the problem is that there is no way to compare it, because I can't access passed dogs age.</p>
  
  <p>Question: How to implement equals method without exposing any fields of object? </p>