aboutsummaryrefslogtreecommitdiff
path: root/website2/templates/features/ToString.html
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2016-10-17 23:09:21 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2017-05-29 21:01:53 +0200
commit599b6aab677439ae1bdea2cdca3233d0b763fd3f (patch)
tree8766f124271d056c8e8c22fd1a8a1ada08284275 /website2/templates/features/ToString.html
parent4e75ed8f8661033662b2d26c4a42fafa9d61b75f (diff)
downloadlombok-599b6aab677439ae1bdea2cdca3233d0b763fd3f.tar.gz
lombok-599b6aab677439ae1bdea2cdca3233d0b763fd3f.tar.bz2
lombok-599b6aab677439ae1bdea2cdca3233d0b763fd3f.zip
Updated just about all of the pages to the template-based redesign.
Added ajaxified loading for feature pages.
Diffstat (limited to 'website2/templates/features/ToString.html')
-rw-r--r--website2/templates/features/ToString.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/website2/templates/features/ToString.html b/website2/templates/features/ToString.html
new file mode 100644
index 00000000..6f230561
--- /dev/null
+++ b/website2/templates/features/ToString.html
@@ -0,0 +1,54 @@
+<#import "_features.html" as f>
+
+<@f.scaffold title="@ToString" logline="No need to start a debugger to see your fields: Just let lombok generate a <code>toString</code> for you!">
+ <@f.overview>
+ <p>
+ Any class definition may be annotated with <code>@ToString</code> to let lombok generate an implementation of the <code>toString()</code> method. By default, it'll print your class name, along with each field, in order, separated by commas.
+ </p><p>
+ By setting the <code>includeFieldNames</code> parameter to <em>true</em> you can add some clarity (but also quite some length) to the output of the <code>toString()</code> method.
+ </p><p>
+ By default, all non-static fields will be printed. If you want to skip some fields, you can name them in the <code>exclude</code> parameter; each named field will not be printed at all. Alternatively, you can specify exactly which fields you wish to be used by naming them in the <code>of</code> parameter.
+ </p><p>
+ By setting <code>callSuper</code> to <em>true</em>, you can include the output of the superclass implementation of <code>toString</code> to the output. Be aware that the default implementation of <code>toString()</code> in <code>java.lang.Object</code> is pretty much meaningless, so you probably don't want to do this unless you are extending another class.
+ </p>
+ </@f.overview>
+
+ <@f.snippets name="ToString" />
+
+ <@f.confKeys>
+ <dt>
+ <code>lombok.toString.includeFieldNames</code> = [<code>true</code> | <code>false</code>] (default: true)
+ </dt><dd>
+ Normally lombok generates a fragment of the toString response for each field in the form of <code>fieldName = fieldValue</code>. If this setting is set to <code>false</code>, lombok will omit the name of the field and simply deploy a comma-separated list of all the field values. The annotation parameter '<code>includeFieldNames</code>', if explicitly specified, takes precedence over this setting.
+ </dd><dt>
+ <code>lombok.toString.doNotUseGetters</code> = [<code>true</code> | <code>false</code>] (default: false)
+ </dt><dd>
+ If set to <code>true</code>, lombok will access fields directly instead of using getters (if available) when generating <code>toString</code> methods. The annotation parameter '<code>doNotUseGetters</code>', if explicitly specified, takes precedence over this setting.
+ </dd><dt>
+ <code>lombok.toString.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
+ </dt><dd>
+ Lombok will flag any usage of <code>@ToString</code> as a warning or error if configured.
+ </dd>
+ </@f.confKeys>
+
+ <@f.smallPrint>
+ <p>
+ If there is <em>any</em> method named <code>toString</code> with no arguments, regardless of return type, no method will be generated, and instead a warning is emitted explaining that your <code>@ToString</code> annotation is doing nothing. You can mark any method with <code>@lombok.experimental.Tolerate</code> to hide them from lombok.
+ </p><p>
+ Arrays are printed via <code>Arrays.deepToString</code>, which means that arrays that contain themselves will result in <code>StackOverflowError</code>s. However, this behaviour is no different from e.g. <code>ArrayList</code>.
+ </p><p>
+ 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.
+ </p><p>
+ Having both <code>exclude</code> and <code>of</code> generates a warning; the <code>exclude</code> parameter will be ignored in that case.
+ </p><p>
+ We don't promise to keep the output of the generated <code>toString()</code> methods the same between lombok versions. You should never design your API so that other code is forced to parse your <code>toString()</code> output anyway!
+ </p><p>
+ By default, any variables that start with a $ symbol are excluded automatically. You can only include them by using the 'of' parameter.
+ </p><p>
+ If a getter exists for a field to be included, it is called instead of using a direct field reference. This behaviour can be suppressed:<br />
+ <code>@ToString(doNotUseGetters = true)</code>
+ </p><p>
+ <code>@ToString</code> can also be used on an enum definition.
+ </p>
+ </@f.smallPrint>
+</@f.scaffold>