diff options
Diffstat (limited to 'website/features/Data.html')
-rw-r--r-- | website/features/Data.html | 25 |
1 files changed, 12 insertions, 13 deletions
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 @@ <div class="header"><a href="../index.html">Project Lombok</a></div> <h1>@Data</h1> <div class="byline">All together now: A shortcut for <code>@ToString</code>, <code>@EqualsAndHashCode</code>, - <code>@Getter</code> on all fields, and <code>@Setter</code> on all non-final fields. You even - get a free constructor to initialize your final fields!</div> + <code>@Getter</code> on all fields, <code>@Setter</code> on all non-final fields, and <code>@RequiredArgsConstructor</code>!</div> <div class="overview"> <h3>Overview</h3> <p> <code>@Data</code> is a convenient shortcut annotation that bundles the features of <a href="ToString.html"><code>@ToString</code></a>, - <a href="EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a> and <a href="GetterSetter.html"><code>@Getter</code> / <code>@Setter</code></a> - together: In other words, <code>@Data</code> generates <em>all</em> 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 <code>toString</code>, <code>equals</code> - and <code>hashCode</code> implementations that involve the fields of the class. In addition, <code>@Data</code> generates a constructor that + <a href="EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a>, <a href="GetterSetter.html"><code>@Getter</code> / <code>@Setter</code></a> + and <a href="Constructor.html"><code>@RequiredArgsConstructor</code></a> together: In other words, <code>@Data</code> generates <em>all</em> 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 <code>toString</code>, <code>equals</code> and <code>hashCode</code> 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 <code>@NonNull</code> or <code>@NotNull</code>, in order to ensure the field is never null. </p><p> - <code>@Data</code> is like having implicit <code>@ToString</code> and <code>@EqualsAndHashCode</code> annotations on the class. - However, the parameters of <code>@ToString</code> and <code>@EqualsAndHashCode</code> (such as <code>callSuper</code>, <code>includeFieldNames</code> and + <code>@Data</code> is like having implicit <code>@Getter</code>, <code>@Setter</code>, <code>@ToString</code>, <code>@EqualsAndHashCode</code> and <code>@RequiredArgsConstructor</code> + annotations on the class. However, the parameters of these annotations (such as <code>callSuper</code>, <code>includeFieldNames</code> and <code>exclude</code>) cannot be set with <code>@Data</code>. If you need to set non-default values for any of these parameters, just add those annotations explicitly; <code>@Data</code> is smart enough to defer to those annotations. </p><p> - All generated getters and setters will be <code>public</code>. To override the access level, annotate the field with an explicit <code>@Setter</code> and/or + All generated getters and setters will be <code>public</code>. To override the access level, annotate the field or class with an explicit <code>@Setter</code> and/or <code>@Getter</code> annotation. You can also use this annotation (by combining it with <code>AccessLevel.NONE</code>) to suppress generating a getter and/or setter altogether. </p><p> @@ -62,8 +61,8 @@ <div style="clear: left;"></div> <div class="overview"> <h3>Small print</h3><div class="smallprint"> - <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>See the small print of <a href="ToString.html"><code>@ToString</code></a>, <a href="EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a>, + <a href="GetterSetter.html"><code>@Getter / @Setter</code></a> and <a href="Constructor.html">@RequiredArgsConstructor</a>. </p><p> 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 @@ -76,8 +75,8 @@ </div> </div> <div class="footer"> - <a href="index.html">Back to features</a> | <a href="EqualsAndHashCode.html">Previous feature (@EqualsAndHashCode)</a> | <a href="Cleanup.html">Next feature (@Cleanup)</a><br /> - <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009 Reinier Zwitserloot and Roel Spilker, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> + <a href="index.html">Back to features</a> | <a href="Constructor.html">Previous feature (@<em>X</em>Constructor)</a> | <a href="Cleanup.html">Next feature (@Cleanup)</a><br /> + <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2010 Reinier Zwitserloot and Roel Spilker, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> </div> <div style="clear: both;"></div> </div> |