Lombok - v0.11.4

lombok.experimental
Annotation Type Value


@Target(value=TYPE)
@Retention(value=SOURCE)
public @interface Value

Generates a lot of code which fits with a class that is a representation of an immutable entity. Specifically, it generates:

In other words, @Value is a shorthand for:
final @Getter @Wither @FieldDefaults(makeFinal=true,level=AccessLevel.PRIVATE) @EqualsAndHashCode @ToString @AllArgsConstructor.

If any method to be generated already exists (in name and parameter c ount - the return type or parameter types are not relevant), then that method will not be generated by the Value annotation.

The generated constructor will have 1 parameter for each 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.11.4

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