From ed61012f95cefae8d03260f506ffe34bc19bd90c Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot
Date: Mon, 18 Feb 2013 21:41:07 +0100
Subject: whoops, belated push and fixes to the documentation of onX
---
buildScripts/website.ant.xml | 6 +-
usage_examples/experimental/onXExample_post.jpage | 22 ++++++
usage_examples/experimental/onXExample_pre.jpage | 15 ++++
usage_examples/onXExample_post.jpage | 22 ------
usage_examples/onXExample_pre.jpage | 15 ----
website/features/Constructor.html | 2 +-
website/features/GetterSetter.html | 2 +-
website/features/experimental/Value.html | 2 +-
website/features/experimental/Wither.html | 2 +-
website/features/experimental/index.html | 10 +--
website/features/experimental/onX.html | 88 +++++++++++++++++++++++
website/features/onX.html | 71 ------------------
12 files changed, 138 insertions(+), 119 deletions(-)
create mode 100644 usage_examples/experimental/onXExample_post.jpage
create mode 100644 usage_examples/experimental/onXExample_pre.jpage
delete mode 100644 usage_examples/onXExample_post.jpage
delete mode 100644 usage_examples/onXExample_pre.jpage
create mode 100644 website/features/experimental/onX.html
delete mode 100644 website/features/onX.html
diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml
index 35e34367..78dc8ed7 100644
--- a/buildScripts/website.ant.xml
+++ b/buildScripts/website.ant.xml
@@ -145,9 +145,6 @@ such as converting the changelog into HTML, and creating javadoc.
-
-
-
@@ -163,6 +160,9 @@ such as converting the changelog into HTML, and creating javadoc.
+
+
+
diff --git a/usage_examples/experimental/onXExample_post.jpage b/usage_examples/experimental/onXExample_post.jpage
new file mode 100644
index 00000000..1be94f2a
--- /dev/null
+++ b/usage_examples/experimental/onXExample_post.jpage
@@ -0,0 +1,22 @@
+import javax.inject.Inject;
+import javax.persistence.Id;
+import javax.persistence.Column;
+import javax.validation.constraints.Max;
+
+public class OnXExample {
+ private long unid;
+
+ @Inject
+ public OnXExample(long unid) {
+ this.unid = unid;
+ }
+
+ @Id @Column(name="unique-id")
+ public long getUnid() {
+ return unid;
+ }
+
+ public void setUnid(@Max(10000) long unid) {
+ this.unid = unid;
+ }
+}
diff --git a/usage_examples/experimental/onXExample_pre.jpage b/usage_examples/experimental/onXExample_pre.jpage
new file mode 100644
index 00000000..fa03e2cd
--- /dev/null
+++ b/usage_examples/experimental/onXExample_pre.jpage
@@ -0,0 +1,15 @@
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.inject.Inject;
+import javax.persistence.Id;
+import javax.persistence.Column;
+import javax.validation.constraints.Max;
+
+@AllArgsConstructor(onConstructor=@_(@Inject))
+public class OnXExample {
+ @Getter(onMethod=@_({@Id, @Column(name="unique-id")}))
+ @Setter(onParam=@_(@Max(10000)))
+ private long unid;
+}
diff --git a/usage_examples/onXExample_post.jpage b/usage_examples/onXExample_post.jpage
deleted file mode 100644
index 1be94f2a..00000000
--- a/usage_examples/onXExample_post.jpage
+++ /dev/null
@@ -1,22 +0,0 @@
-import javax.inject.Inject;
-import javax.persistence.Id;
-import javax.persistence.Column;
-import javax.validation.constraints.Max;
-
-public class OnXExample {
- private long unid;
-
- @Inject
- public OnXExample(long unid) {
- this.unid = unid;
- }
-
- @Id @Column(name="unique-id")
- public long getUnid() {
- return unid;
- }
-
- public void setUnid(@Max(10000) long unid) {
- this.unid = unid;
- }
-}
diff --git a/usage_examples/onXExample_pre.jpage b/usage_examples/onXExample_pre.jpage
deleted file mode 100644
index 2cc9c581..00000000
--- a/usage_examples/onXExample_pre.jpage
+++ /dev/null
@@ -1,15 +0,0 @@
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.inject.Inject;
-import javax.persistence.Id;
-import javax.persistence.Column;
-import javax.validation.constraints.Max;
-
-@AllArgsConstructor(onConstructor=@Inject)
-public class OnXExample {
- @Getter(onMethod={@Id, @Column(name="unique-id"})
- @Setter(onParam=@Max(10000))
- private long unid;
-}
diff --git a/website/features/Constructor.html b/website/features/Constructor.html
index 051d730e..cdd5b4e2 100644
--- a/website/features/Constructor.html
+++ b/website/features/Constructor.html
@@ -35,7 +35,7 @@
Such a static factory method will infer generics, unlike a normal constructor. This means your API users get write MapEntry.of("foo", 5)
instead of the much longer
new MapEntry<String, Integer>("foo", 5)
.
- To put annotations on the generated constructor, you can use onConstructor={@AnnotationsHere}
. For more details see the documentation on the onX feature.
+ To put annotations on the generated constructor, you can use onConstructor=@_({@AnnotationsHere})
, but be careful; this is an experimental feature. For more details see the documentation on the onX feature.
Static fields are skipped by these annotations. Also, a @java.beans.ConstructorProperties
annotation is added for all constructors with at least 1 argument,
which allows bean editor tools to call the generated constructors. @ConstructorProperties
is now in Java 1.6, which means that if your code is intended for
diff --git a/website/features/GetterSetter.html b/website/features/GetterSetter.html
index dde3456b..03704119 100644
--- a/website/features/GetterSetter.html
+++ b/website/features/GetterSetter.html
@@ -29,7 +29,7 @@
You can always manually disable getter/setter generation for any field by using the special AccessLevel.NONE
access level. This lets you override the
behaviour of a @Getter
, @Setter
or @Data
annotation on a class.
- To put annotations on the generated method, you can use onMethod={@AnnotationsHere}
; to put annotations on the only parameter of a generated setter method, you can use onParam={@AnnotationsHere}
. For more details see the documentation on the onX feature.
+ To put annotations on the generated method, you can use onMethod=@_({@AnnotationsHere})
; to put annotations on the only parameter of a generated setter method, you can use onParam=@_({@AnnotationsHere})
. Be careful though! This is an experimental feature. For more details see the documentation on the onX feature.
diff --git a/website/features/experimental/Value.html b/website/features/experimental/Value.html
index a82808e2..fb726d7b 100644
--- a/website/features/experimental/Value.html
+++ b/website/features/experimental/Value.html
@@ -68,7 +68,7 @@
diff --git a/website/features/experimental/Wither.html b/website/features/experimental/Wither.html
index b0700aab..da2156cd 100644
--- a/website/features/experimental/Wither.html
+++ b/website/features/experimental/Wither.html
@@ -45,7 +45,7 @@
@Wither(level = AccessLevel.PROTECTED)
. Also like @Setter
, you can also put a @Wither
annotation on a type, which means
a 'wither' is generated for each field (even non-final fields).
- To put annotations on the generated method, you can use onMethod={@AnnotationsHere}
; to put annotations on the only parameter of this method, you can use onParam={@AnnotationsHere}
. For more details see the documentation on the onX feature.
+ To put annotations on the generated method, you can use onMethod=@_({@AnnotationsHere})
; to put annotations on the only parameter of a generated wither method, you can use onParam=@_({@AnnotationsHere})
. Be careful though! This is an experimental feature. For more details see the documentation on the onX feature.
diff --git a/website/features/experimental/index.html b/website/features/experimental/index.html
index acbbdbf6..24fbb541 100644
--- a/website/features/experimental/index.html
+++ b/website/features/experimental/index.html
@@ -24,14 +24,16 @@
@Accessors
- A more fluent API for getters and setters.
- @ExtensionMethod
+ @ExtensionMethod
- Annoying API? Fix it yourself: Add new methods to existing types!
- @FieldDefaults
+ @FieldDefaults
- New default field modifiers for the 21st century.
- @Wither
+ @Wither
- Immutable 'setters' - methods that create a clone but with one changed field.
- @Value
+ @Value
- Immutable classes made very easy.
+ onMethod= / onConstructor= / onParam
+ - Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.