From aee4e76d864e01b5d453409e703ad54852fa57bb Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot @Value
: @ToString
, @EqualsAndHashCode
, @AllArgsConstructor
, @FieldDefaults
, and @Getter
.
For classes with generics, it's useful to have a static method which serves as a constructor, because inference of generic parameters via static methods works in java6 and avoids having to use the diamond operator. While you can force this by applying an explicit @AllArgsConstructor(staticConstructor="of")
annotation, there's also the @Value(staticConstructor="of")
feature, which will make the generated all-arguments constructor private, and generates a public static method named of
which is a wrapper around this private constructor.
+
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to the relevant places (such as the method for getters, and the parameter for the constructor and setters). See Getter/Setter documentation's small print for more information.
@Value
was an experimental feature from v0.11.4 to v0.11.9 (as @lombok.experimental.Value
). It has since been moved into the core package. The old annotation is still around (and is an alias). It will eventually be removed in a future version, though.
-- cgit