- Direct Known Subclasses:
- FlagMetadata, ShellArgument
public abstract class ObjectOverrides
extends java.lang.Object
This easy to use class implements overrides of the equals, hashcode and toString methods based on the EqualsBuilder,
HashCodeBuilder and ToStringBuilder of apache lang using reflection. This is a genuine, Eazy Erik approved, hack. Why
is it a hack you ask? It abuses the inheritance hierarchy for a completely different purpose than it was intended
for. Therefore, do NOT use this class in instanceof tests. Classes that extend ObjectOverrides do not share any
common characteristic, so from a pure OO perspective this class is an abomination. Do not extend this class with
utilities, because this ties the extending class to a class it should not be aware of. On the bright side though, it
reduces clutter by not requiring every class to add these three simple overrides. Its main purpose is supporting
debugging & unit tests. The toString method is useful for debugging. Many classes don't require a hashcode and equals
method. This makes these classes hard to unit test, though. I don't like the idea of cluttering production code for
testing purposes and this parent class restricts the clutter to a minimum.
- Author:
- Erik Lievaart