aboutsummaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-09-03 01:44:59 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-09-03 01:44:59 +0200
commitf1124aad02569c983cb8979445245141bf029a88 (patch)
tree80d25bb1dddcfce46931f298b6f70ebdbd2e3e13 /website
parent6b7919166e9a550d7d2b1f7156c794e76905fcab (diff)
downloadlombok-f1124aad02569c983cb8979445245141bf029a88.tar.gz
lombok-f1124aad02569c983cb8979445245141bf029a88.tar.bz2
lombok-f1124aad02569c983cb8979445245141bf029a88.zip
Addressed issue #32: The @EqualsAndHashCode and @ToString annotations now support explicitly listing the fields to use, via the new 'of' parameter.
We've also added any fields that start with $ to the default excludes list. Lombok itself can generate these fields ($lock of @Synchronized, for example), and in general they probably should count as effectively not part of the class.
Diffstat (limited to 'website')
-rw-r--r--website/features/Data.html2
-rw-r--r--website/features/EqualsAndHashCode.html5
-rw-r--r--website/features/GetterSetter.html2
-rw-r--r--website/features/ToString.html8
4 files changed, 13 insertions, 4 deletions
diff --git a/website/features/Data.html b/website/features/Data.html
index 9216d46e..9babb9f9 100644
--- a/website/features/Data.html
+++ b/website/features/Data.html
@@ -64,7 +64,7 @@
<p>See the small print of <a href="ToString.html"><code>@ToString</code></a>, <a href="EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a> and
<a href="GetterSetter.html"><code>@Getter / @Setter</code></a>.
</p><p>
- Any annotations named <code>@NonNull</code> or <code>@NotNull</code> (case insensitive) on a field are interpreted as: This field must not ever hold
+ Any annotations named <code>@NonNull</code> (case insensitive) on a field are interpreted as: This field must not ever hold
<em>null</em>. Therefore, these annotations result in an explicit null check in the generated constructor for the provided field. Also, these
annotations (as well as any annotation named <code>@Nullable</code>) are copied to the constructor parameter, in both the true constructor and
any static constructor. The same principle applies to generated getters and setters (see the documentation for <a href="GetterSetter.html">@Getter / @Setter</a>)
diff --git a/website/features/EqualsAndHashCode.html b/website/features/EqualsAndHashCode.html
index d42891e7..d2575244 100644
--- a/website/features/EqualsAndHashCode.html
+++ b/website/features/EqualsAndHashCode.html
@@ -18,6 +18,7 @@
Any class definition may be annotated with <code>@EqualsAndHashCode</code> to let lombok generate implementations of the
<code>equals(Object other)</code> and <code>hashCode()</code> methods. By default, it'll use all non-static, non-transient
fields, but you can exclude more fields by naming them in the optional <code>exclude</code> parameter to the annotation.
+ 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 <code>equals</code> and <code>hashCode</code> methods of your superclass in the generated methods.
For <code>hashCode</code>, the result of <code>super.hashCode()</code> is included in the hash algorithm, and for <code>equals</code>, the generated method will return
@@ -65,6 +66,10 @@
</p><p>
Attempting to exclude fields that don't exist or would have been excluded anyway (because they are static or transient) 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>
+ By default, any variables that start with a $ symbol are excluded automatically. You can only include them by using the 'of' parameter.
</p>
</div>
</div>
diff --git a/website/features/GetterSetter.html b/website/features/GetterSetter.html
index 618a6b0a..27bafc70 100644
--- a/website/features/GetterSetter.html
+++ b/website/features/GetterSetter.html
@@ -52,7 +52,7 @@
Any variation on <code>boolean</code> will <em>not</em> result in using the <code>is</code> prefix instead of the <code>get</code> prefix; for example,
returning <code>java.lang.Boolean</code> results in a <code>get</code> prefix, not an <code>is</code> prefix.
</p><p>
- Any annotations named <code>@NonNull</code> or <code>@NotNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold
+ Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold
<em>null</em>. Therefore, these annotations result in an explicit null check in the generated setter. Also, these
annotations (as well as any annotation named <code>@Nullable</code>) are copied to setter parameter and getter method
</p>
diff --git a/website/features/ToString.html b/website/features/ToString.html
index 0ed142a1..2b1d7b33 100644
--- a/website/features/ToString.html
+++ b/website/features/ToString.html
@@ -21,8 +21,8 @@
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>
- 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.
+ 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
@@ -53,8 +53,12 @@
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>
</div>
</div>