From 893585f526b852ff5059d279e69927fab0d41d42 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 10 Feb 2014 20:22:33 +0100 Subject: [i386] documentation update for Data/Value's behaviour in the face of existing constructors. --- website/features/Data.html | 2 +- website/features/Value.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/features/Data.html b/website/features/Data.html index ad3aa892..4d6e5609 100644 --- a/website/features/Data.html +++ b/website/features/Data.html @@ -38,7 +38,7 @@

If the class already contains a method with the same name as any method that would normally be generated, that method is not generated, and no warning or error is emitted. For example, if you already have a method with signature void hashCode(int a, int b, int c), no int hashCode() - method will be generated, even though technically int hashCode() is an entirely different method. The same rule applies to the constructor, + method will be generated, even though technically int hashCode() is an entirely different method. The same rule applies to the constructor (any explicit constructor will prevent @Data from generating one), toString, equals, and all getters and setters.

@Data can handle generics parameters for fields just fine. In order to reduce the boilerplate when constructing objects for classes with diff --git a/website/features/Value.html b/website/features/Value.html index 6bbd6f2a..e5dc7d9e 100644 --- a/website/features/Value.html +++ b/website/features/Value.html @@ -27,7 +27,7 @@ @Value is the immutable variant of @Data; all fields are made private and final by default, and setters are not generated. The class itself is also made final by default, because immutability is not something that can be forced onto a subclass. Like @Data, useful toString(), equals() and hashCode() methods are also generated, each field gets a getter method, and a constructor that covers every argument (except final fields that are initialized in the field declaration) is also generated.

- In practice, @Value is shorthand for: final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter. + In practice, @Value is shorthand for: final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter, except that explicitly including an implementation of any of the relevant methods simply means that part won't be generated and no warning will be emitted. For example, if you write your own toString, no error occurs, and lombok will not generate a toString. Also, any explicit constructor, no matter the arguments list, implies lombok will not generate a constructor. If you do want lombok to generate the all-args constructor, add @AllArgsConstructor to the class.

It is possible to override the final-by-default and private-by-default behaviour using either an explicit access level on a field, or by using the @NonFinal or @PackagePrivate annotations.
It is possible to override any default behaviour for any of the 'parts' that make up @Value by explicitly using that annotation. -- cgit