Annotation Type IgnoredByEquals


  • @Target(METHOD)
    @Retention(SOURCE)
    public @interface IgnoredByEquals
    FreeBuilder will not check properties annotated @IgnoredByEquals when comparing objects in its generated Object.equals(Object).

    To maintain the contract of Object.hashCode()), the value of these properties will also be ignored in the generated implementation of that method.

    Warning: Dropping properties from equality checks makes it very easy to accidentally write broken unit tests (and hard to write good ones). If you find yourself wanting to use this annotation, consider first whether you actually want a different collection type (typicaly a Map rather than a Set, for instance), or whether you can use an explicit field-ignoring Comparator in the parts of the code that need it.