|
Lombok - v0.10.8 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value=TYPE) @Retention(value=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.
If any method to be generated already exists (in name - the return type or parameters are not relevant), then that method will not be generated by the Data annotation.
The generated constructor will have 1 parameter for each final field. The generated toString will print all fields,
while the generated hashCode and equals take into account all non-transient fields.
Static fields are skipped (no getter or setter, and they are not included in toString, equals, hashCode, or the constructor).
toString
, equals
, and hashCode
use the deepX variants in the
java.util.Arrays
utility class. Therefore, if your class has arrays that contain themselves,
these methods will just loop endlessly until the inevitable StackOverflowError
. This behaviour
is no different from java.util.ArrayList
, though.
Optional Element Summary | |
---|---|
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. |
public abstract String staticConstructor
public @Data(staticConstructor = "of") class Point { final int x, y; }Default: No static constructor, instead the normal constructor is public.
|
Lombok - v0.10.8 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |