From fb6be45d2bcb97e0e0288ba81a602679c7bedc46 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 28 Jul 2009 17:38:26 +0200 Subject: Added website feature documentation for @ToString and @EqualsAndHashCode, and modified the docs for @Data to refer to the docs of these new annotations. The build script for the website has been updated to clean out the website build dir first, so files that used to exist but have now been tossed are no longer there. There's also a special website-no-videos target which builds a website deployable without the videos. This makes the upload a lot faster if the videos haven't changed. --- website/features/ToString.html | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 website/features/ToString.html (limited to 'website/features/ToString.html') diff --git a/website/features/ToString.html b/website/features/ToString.html new file mode 100644 index 00000000..e970d88c --- /dev/null +++ b/website/features/ToString.html @@ -0,0 +1,78 @@ + + + + + + + + @Data +
+
+
+ +

@ToString

+ +
+

Overview

+

+ Any class definition may be annotated with @ToString to let lombok generate an implementation of the + toString() method. By default, it'll print your class name, along with each field, in order, separated by commas. +

+ By setting the includeFieldNames parameter to true you can add some clarity (but also quite some length) to + the output of the toString() method. +

+ All non-static fields will be printed. If you want to skip some fields, you can name them in the exclude parameter; each named + field will not be printed at all. +

+ By setting callSuper to true, you can include the output of the superclass implementation of toString to the + output. Be aware that the default implementation of toString() in java.lang.Object is pretty much meaningless, so you + probably don't want to do this unless you are extending another class. +

+
+
+
+

With Lombok

+
@HTML_PRE@
+
+
+
+

Vanilla Java

+
@HTML_POST@
+
+
+
+
+

Small print

+

+ If there is any method named toString regardless of parameters or return type, no method will be generated, and instead + a warning is emitted explaining that your @ToString annotation is doing nothing. +

+ Arrays are printed via Arrays.deepToString, which means that arrays that contain themselves will result in StackOverflowErrors. However, + this behaviour is no different from e.g. ArrayList. +

+ Attempting to exclude fields that don't exist or would have been excluded anyway (because they are static) results in warnings on the named fields. + You therefore don't have to worry about typos. +

+ We don't promise to keep the output of the generated toString() methods the same between lombok versions. You should never design your API so that + other code is forced to parse your toString() output anyway! +

+
+
+ +
+
+
+ + + -- cgit