From 58851b4c6e96a51d1ac298c7ed85efac6ffe8335 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 17 Nov 2012 19:12:01 +0100 Subject: Updated the javadoc of each and every feature annotation that lombok has: * Removed most documentation and instead put in a link to the much more up to date and extensive documentation at http://projectlombok.org/features * Getting ahead of ourselves a little, added notes on onConstructor/onParam/onMethod which we are about to add in the next few commits. * Updated copyrights to 2012. --- src/core/lombok/experimental/Accessors.java | 3 +++ src/core/lombok/experimental/ExtensionMethod.java | 3 +++ src/core/lombok/experimental/FieldDefaults.java | 5 ++-- src/core/lombok/experimental/Value.java | 31 +++++++---------------- src/core/lombok/experimental/Wither.java | 7 ++--- 5 files changed, 22 insertions(+), 27 deletions(-) (limited to 'src/core/lombok/experimental') diff --git a/src/core/lombok/experimental/Accessors.java b/src/core/lombok/experimental/Accessors.java index b925e746..2748bfa9 100644 --- a/src/core/lombok/experimental/Accessors.java +++ b/src/core/lombok/experimental/Accessors.java @@ -28,6 +28,9 @@ import java.lang.annotation.Target; /** * A container for settings for the generation of getters and setters. + *

+ * Complete documentation is found at the project lombok features page for @Accessors. + *

* Using this annotation does nothing by itself; an annotation that makes lombok generate getters and setters, * such as {@link lombok.Setter} or {@link lombok.Data} is also required. */ diff --git a/src/core/lombok/experimental/ExtensionMethod.java b/src/core/lombok/experimental/ExtensionMethod.java index 74787fac..44f28d04 100644 --- a/src/core/lombok/experimental/ExtensionMethod.java +++ b/src/core/lombok/experimental/ExtensionMethod.java @@ -31,6 +31,9 @@ import java.lang.annotation.*; * otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as * if they were instance methods on the extended type. *

+ * Complete documentation is found at the project lombok features page for @ExtensionMethod. + *

+ *

* Before: * *

diff --git a/src/core/lombok/experimental/FieldDefaults.java b/src/core/lombok/experimental/FieldDefaults.java
index 5bbf92dc..8a3fb534 100644
--- a/src/core/lombok/experimental/FieldDefaults.java
+++ b/src/core/lombok/experimental/FieldDefaults.java
@@ -30,12 +30,13 @@ import lombok.AccessLevel;
 
 /**
  * Adds modifiers to each field in the type with this annotation.
+ * 

+ * Complete documentation is found at the project lombok features page for @FieldDefaults. + *

* If {@code makeFinal} is {@code true}, then each field that is not annotated with {@code @NonFinal} will have the {@code final} modifier added. *

* If {@code level} is set, then each field that is package private (i.e. no access modifier) and does not have the {@code @PackagePrivate} annotation will * have the appropriate access level modifier added. - *

- * The only fields that are skipped are those that start with a '$'; everything else, including static, volatile, and transient fields, are modified. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) diff --git a/src/core/lombok/experimental/Value.java b/src/core/lombok/experimental/Value.java index 70ac1ba7..6c07d2fc 100644 --- a/src/core/lombok/experimental/Value.java +++ b/src/core/lombok/experimental/Value.java @@ -28,30 +28,17 @@ import java.lang.annotation.Target; /** * Generates a lot of code which fits with a class that is a representation of an immutable entity. - * Specifically, it generates:

- * - * In other words, {@code @Value} is a shorthand for:
- * {@code final @Getter @Wither @FieldDefaults(makeFinal=true,level=AccessLevel.PRIVATE) @EqualsAndHashCode @ToString @AllArgsConstructor}. - *

- * If any method to be generated already exists (in name and parameter count - the return type or parameter types are not relevant), then - * that method will not be generated by the Value annotation. *

- * The generated constructor will have 1 parameter for each field. The generated toString will print all fields, - * while the generated hashCode and equals take into account all non-transient fields.
- * Static fields are skipped (no getter or setter, and they are not included in toString, equals, hashCode, or the constructor). + * Equivalent to {@code @Getter @Wither @FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE) @RequiredArgsConstructor @ToString @EqualsAndHashCode}. *

- * {@code toString}, {@code equals}, and {@code hashCode} use the deepX variants in the - * {@code java.util.Arrays} utility class. Therefore, if your class has arrays that contain themselves, - * these methods will just loop endlessly until the inevitable {@code StackOverflowError}. This behaviour - * is no different from {@code java.util.ArrayList}, though. + * Complete documentation is found at the project lombok features page for @Value. + * + * @see lombok.Getter + * @see Wither + * @see lombok.RequiredArgsConstructor + * @see lombok.ToString + * @see lombok.EqualsAndHashCode + * @see lombok.Data */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) diff --git a/src/core/lombok/experimental/Wither.java b/src/core/lombok/experimental/Wither.java index ec2f5496..58be660a 100644 --- a/src/core/lombok/experimental/Wither.java +++ b/src/core/lombok/experimental/Wither.java @@ -31,6 +31,10 @@ import lombok.AccessLevel; /** * Put on any field to make lombok build a 'wither' - a withX method which produces a clone of this object (except for 1 field which gets a new value). *

+ * Complete documentation is found at the project lombok features page for @Wither. + *

+ * Even though it is not listed, this annotation also has the {@code onParam} and {@code onMethod} parameter. See the full documentation for more details. + *

* Example: *

  *     private @Wither final int foo;
@@ -43,9 +47,6 @@ import lombok.AccessLevel;
  *         return this.foo == foo ? this : new SELF_TYPE(otherField1, otherField2, foo);
  *     }
  * 
- * - * If any method named {@code withFoo} (case insensitive) exists, regardless of return type or parameters, - * no method is generated, and instead a compiler warning is emitted. *

* This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have * a {@code Wither} annotation have the annotation. -- cgit