Annotation Type Data


@Target(TYPE) @Retention(SOURCE) public @interface Data
Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor (except that no constructor will be generated if any explicitly written constructors already exist).

Equivalent to @Getter @Setter @RequiredArgsConstructor @ToString @EqualsAndHashCode.

Complete documentation is found at the project lombok features page for @Data.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    If you specify a static constructor name, then the generated constructor will be private, and instead a static factory method is created that other classes can use to create instances.
  • Element Details

    • staticConstructor

      String staticConstructor
      If you specify a static constructor name, then the generated constructor will be private, and instead a static factory method is created that other classes can use to create instances. We suggest the name: "of", like so:
           public @Data(staticConstructor = "of") class Point { final int x, y; }
       
      Default: No static constructor, instead the normal constructor is public.
      Returns:
      Name of static 'constructor' method to generate (blank = generate a normal constructor).
      Default:
      ""