From aaf8547d91a540334419f2faebb897b327d535d8 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 20 Jul 2010 07:43:02 +0200 Subject: Added documentation for @RequiredArgsConstructor, @NoArgsConstructor, @AllArgsConstructor, and also how these generate @ConstructorProperties annotations. Also updated @Getter and @Setter's documentation to explain their new class-level feature, and updated @Data's description to highlight how @Data is now truly nothing more than the combination of @RequiredArgsConstructor, @EqualsAndHashCode, @ToString, @Getter, and @Setter. --- website/features/Data.html | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'website/features/Data.html') diff --git a/website/features/Data.html b/website/features/Data.html index 8e33be8f..45b28403 100644 --- a/website/features/Data.html +++ b/website/features/Data.html @@ -12,25 +12,24 @@
Project Lombok

@Data

All together now: A shortcut for @ToString, @EqualsAndHashCode, - @Getter on all fields, and @Setter on all non-final fields. You even - get a free constructor to initialize your final fields!
+ @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor!

Overview

@Data is a convenient shortcut annotation that bundles the features of @ToString, - @EqualsAndHashCode and @Getter / @Setter - together: In other words, @Data generates all the boilerplate that is normally associated with simple POJOs - (Plain Old Java Objects) and beans: getters for all fields, setters for all non-final fields, and appropriate toString, equals - and hashCode implementations that involve the fields of the class. In addition, @Data generates a constructor that + @EqualsAndHashCode, @Getter / @Setter + and @RequiredArgsConstructor together: In other words, @Data generates all the + boilerplate that is normally associated with simple POJOs (Plain Old Java Objects) and beans: getters for all fields, setters for all non-final fields, + and appropriate toString, equals and hashCode implementations that involve the fields of the class, and a constructor that initializes all final fields, as well as all non-final fields with no initializer that have been marked with @NonNull or @NotNull, in order to ensure the field is never null.

- @Data is like having implicit @ToString and @EqualsAndHashCode annotations on the class. - However, the parameters of @ToString and @EqualsAndHashCode (such as callSuper, includeFieldNames and + @Data is like having implicit @Getter, @Setter, @ToString, @EqualsAndHashCode and @RequiredArgsConstructor + annotations on the class. However, the parameters of these annotations (such as callSuper, includeFieldNames and exclude) cannot be set with @Data. If you need to set non-default values for any of these parameters, just add those annotations explicitly; @Data is smart enough to defer to those annotations.

- All generated getters and setters will be public. To override the access level, annotate the field with an explicit @Setter and/or + All generated getters and setters will be public. To override the access level, annotate the field or class with an explicit @Setter and/or @Getter annotation. You can also use this annotation (by combining it with AccessLevel.NONE) to suppress generating a getter and/or setter altogether.

@@ -62,8 +61,8 @@

Small print

-

See the small print of @ToString, @EqualsAndHashCode and - @Getter / @Setter. +

See the small print of @ToString, @EqualsAndHashCode, + @Getter / @Setter and @RequiredArgsConstructor.

Any annotations named @NonNull (case insensitive) on a field are interpreted as: This field must not ever hold null. Therefore, these annotations result in an explicit null check in the generated constructor for the provided field. Also, these @@ -76,8 +75,8 @@

-- cgit