aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2012-03-27 00:21:06 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-03-27 00:22:13 +0200
commit10b6166ff33ee633fca93d74d87965ada5df4269 (patch)
treeb0fe3d7d44c88c9aefd75f30f2fb5698d3cb4a46
parent19466a5413d0c451b89d0d70a8ba8f5fe0fc98aa (diff)
downloadlombok-10b6166ff33ee633fca93d74d87965ada5df4269.tar.gz
lombok-10b6166ff33ee633fca93d74d87965ada5df4269.tar.bz2
lombok-10b6166ff33ee633fca93d74d87965ada5df4269.zip
Finished up documentation for Accessors.
-rw-r--r--doc/changelog.markdown1
-rw-r--r--usage_examples/AccessorsExample_post.jpage20
-rw-r--r--usage_examples/AccessorsExample_pre.jpage14
-rw-r--r--website/features/GetterSetter.html6
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>