Annotation Type EqualsAndHashCode.Include

Enclosing class:
EqualsAndHashCode

@Target({FIELD,METHOD}) @Retention(SOURCE) public static @interface EqualsAndHashCode.Include
Configure the behaviour of how this member is treated in the equals and hashCode implementation; if on a method, include the method's return value as part of calculating hashCode/equality.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Higher ranks are considered first.
    Defaults to the method name of the annotated member.
  • Element Details

    • replaces

      String replaces
      Defaults to the method name of the annotated member. If on a method and the name equals the name of a default-included field, this member takes its place.
      Returns:
      If present, this method serves as replacement for the named field.
      Default:
      ""
    • rank

      int rank
      Higher ranks are considered first. Members of the same rank are considered in the order they appear in the source file. If not explicitly set, the default rank for primitives is 1000, and for primitive wrappers 800.
      Returns:
      ordering within the generating equals and hashCode methods; higher numbers are considered first.
      Default:
      0