diff options
-rw-r--r-- | doc/changelog.markdown | 1 | ||||
-rw-r--r-- | usage_examples/AccessorsExample_post.jpage | 20 | ||||
-rw-r--r-- | usage_examples/AccessorsExample_pre.jpage | 14 | ||||
-rw-r--r-- | website/features/GetterSetter.html | 6 |
4 files changed, 38 insertions, 3 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index f06cd563..f4923b5d 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -2,6 +2,7 @@ Lombok Changelog ---------------- ### v0.10.9 (edge) +* FEATURE: [Experimental] 'fluent' getters and setters (using just `fieldName` as methodname instead of `getFieldName`), setters that return `this` instead of `void`, and support for fields with prefixes is introduced with this lombok version. Also, the number of parameters of any existing methods with the same name that lombok would generate are now taken into account; previously if you had any method named `setX` regardless of how many parameters it has, lombok would avoid generating a `setX` method. Now lombok generates the method if all present `setX` methods have a number of parameters other than 1. [documentation](http://projectlombok.org/features/experimental/Accessors.html). * FEATURE: The combination of `@Delegate` and `@Getter` or `@Data` will now delegate to the result of a generated getter. [Issue #328](http://code.google.com/p/projectlombok/issues/detail?id=328) * BUGFIX: In NetBeans the generated default constructor would still be generated even if Lombok also generated constructors. [Issue #326](http://code.google.com/p/projectlombok/issues/detail?id=326) * BUGFIX: Some classes that contain @SneakyThrows would not compile (throw ClassFormatError). [Issue 339](http://code.google.com/p/projectlombok/issues/detail?id=339) diff --git a/usage_examples/AccessorsExample_post.jpage b/usage_examples/AccessorsExample_post.jpage new file mode 100644 index 00000000..ae5a39db --- /dev/null +++ b/usage_examples/AccessorsExample_post.jpage @@ -0,0 +1,20 @@ +public class AccessorsExample { + private int age = 10; + + public int age() { + return this.age; + } + + public AccessorsExample age(final int age) { + this.age = age; + return this; + } +} + +class PrefixExample { + private String fName = "Hello, World!"; + + public String getName() { + return this.fName; + } +} diff --git a/usage_examples/AccessorsExample_pre.jpage b/usage_examples/AccessorsExample_pre.jpage new file mode 100644 index 00000000..ef063daa --- /dev/null +++ b/usage_examples/AccessorsExample_pre.jpage @@ -0,0 +1,14 @@ +import lombok.Accessors; +import lombok.Getter; +import lombok.Setter; + +@Accessors(fluent = true) +public class AccessorsExample { + @Getter @Setter + private int age = 10; +} + +class PrefixExample { + @Accessors(prefix = "f") @Getter + private String fName = "Hello, World!"; +} diff --git a/website/features/GetterSetter.html b/website/features/GetterSetter.html index 159aa525..b1ae5f24 100644 --- a/website/features/GetterSetter.html +++ b/website/features/GetterSetter.html @@ -48,9 +48,9 @@ For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified. Then, get/set/is is prefixed. </p><p> - No method is generated if any method already exists with the same name, even if the parameter list is different. For example, <code>getFoo()</code> - will not be generated if there's already a method <code>getFoo(int x)</code> even though it is technically possible to make the method. This caveat - exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. + No method is generated if any method already exists with the same name and same parameter count. For example, <code>getFoo()</code> + will not be generated if there's already a method <code>getFoo(String... x)</code> even though it is technically possible to make the method. This caveat + exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. Varargs count as 0 to N parameters. </p><p> For <code>boolean</code> fields that start with <code>is</code> immediately followed by a title-case letter, nothing is prefixed to generate the getter name. </p><p> |