diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-18 22:42:39 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-18 22:42:39 +0100 |
commit | 06537da4e0d1c420c6669f6ce1490ea56adc4d7d (patch) | |
tree | 261b27a692e598d434aae2f5efc3faa6998dcd4c /website/features | |
parent | ed61012f95cefae8d03260f506ffe34bc19bd90c (diff) | |
download | lombok-06537da4e0d1c420c6669f6ce1490ea56adc4d7d.tar.gz lombok-06537da4e0d1c420c6669f6ce1490ea56adc4d7d.tar.bz2 lombok-06537da4e0d1c420c6669f6ce1490ea56adc4d7d.zip |
Changed @Value to no longer imply @Wither. Usually you want only
a few or no withers at all, and adding them is a lot simpler than
removing them. This is a breaking change, but then that's why @Value
was in experimental in the first place.
Diffstat (limited to 'website/features')
-rw-r--r-- | website/features/experimental/Value.html | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/website/features/experimental/Value.html b/website/features/experimental/Value.html index fb726d7b..d2acfee4 100644 --- a/website/features/experimental/Value.html +++ b/website/features/experimental/Value.html @@ -15,8 +15,9 @@ <div class="since"> <h3>Since</h3> <p> - @Value was introduced as experimental feature in lombok v0.11.4. - </p> + <code>@Value</code> was introduced as experimental feature in lombok v0.11.4. + </p><p> + <code>@Value</code> no longer implies <code>@Wither</code> since lombok v0.11.8. </div> <div class="experimental"> <h3>Experimental</h3> @@ -24,19 +25,16 @@ Experimental because: <ul> <li>Various choices still have to be vetted as being the correct 'least surprise' choice: Should the class be made final by default, etc.</li> - <li>Dependent on @Wither which is experimental.</li> </ul> Current status: <em>positive</em> - Currently we feel this feature may move out of experimental status with no or minor changes soon. </div> <div class="overview"> <h3>Overview</h3> <p> - <code>@Value</code> is the immutable variant of <a href="../Data.html"><code>@Data</code></a>; all fields are made <code>private</code> and <code>final</code> by default, and instead of setters, each field gets a so-called 'wither', - which is a method that produces a clone with each field having the same value, except for the field you want a new value for. The class itself is also made <code>final</code> by default, because immutability is not something that can - be forced onto a subclass. Like <code>@Data</code>, useful <code>toString()</code>, <code>equals()</code> and <code>hashCode()</code> methods are also generated, each field gets a getter method, and a constructor that covers every + <code>@Value</code> is the immutable variant of <a href="../Data.html"><code>@Data</code></a>; all fields are made <code>private</code> and <code>final</code> by default, and setters are not generated. The class itself is also made <code>final</code> by default, because immutability is not something that can be forced onto a subclass. Like <code>@Data</code>, useful <code>toString()</code>, <code>equals()</code> and <code>hashCode()</code> methods are also generated, each field gets a getter method, and a constructor that covers every argument (except <code>final</code> fields that are initialized in the field declaration) is also generated. </p><p> - In practice, <code>@Value</code> is shorthand for: <code>final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter @Wither</code>. + In practice, <code>@Value</code> is shorthand for: <code>final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter</code>. </p><p> 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 <code>@NonFinal</code> or <code>@PackagePrivate</code> annotations.<br /> It is possible to override any default behaviour for any of the 'parts' that make up <code>@Value</code> by explicitly using that annotation. @@ -57,13 +55,9 @@ <div class="overview"> <h3>Small print</h3><div class="smallprint"> <p> - Look for the documentation on the 'parts' of <code>@Value</code>: <a href="../ToString.html"><code>@ToString</code></a>, <a href="../EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a>, - <a href="../Constructor.html"><code>@AllArgsConstructor</code></a>, <a href="FieldDefaults.html"><code>@FieldDefaults</code></a>, <a href="../GetterSetter.html"><code>@Getter</code></a>, - <a href="Wither.html"><code>@Wither</code></a>. + Look for the documentation on the 'parts' of <code>@Value</code>: <a href="../ToString.html"><code>@ToString</code></a>, <a href="../EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a>, <a href="../Constructor.html"><code>@AllArgsConstructor</code></a>, <a href="FieldDefaults.html"><code>@FieldDefaults</code></a>, and <a href="../GetterSetter.html"><code>@Getter</code></a>. </p><p> - For classes with generics, it's useful to have a static method which serves as a constructor, because inference of generic parameters via static methods works in java6 and avoids having to use the diamond operator. - While you can force this by applying an explicit <code>@AllArgsConstructor</code> annotation, there's also the <code>@Value(staticConstructor="of")</code> feature, which will make the generated all-arguments constructor - private, and generates a public static method named <code>of</code> which is a wrapper around this private constructor. + For classes with generics, it's useful to have a static method which serves as a constructor, because inference of generic parameters via static methods works in java6 and avoids having to use the diamond operator. While you can force this by applying an explicit <code>@AllArgsConstructor(staticConstructor="of")</code> annotation, there's also the <code>@Value(staticConstructor="of")</code> feature, which will make the generated all-arguments constructor private, and generates a public static method named <code>of</code> which is a wrapper around this private constructor. </p> </div> </div> |