Lombok - v0.10.8

lombok
Annotation Type Data


@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.
 

staticConstructor

public abstract 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.

Default:
""

Lombok - v0.10.8

Copyright © 2009-2011 The Project Lombok Authors, licensed under the MIT licence.