diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-18 21:41:07 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-18 21:41:07 +0100 |
commit | ed61012f95cefae8d03260f506ffe34bc19bd90c (patch) | |
tree | 7f7478ed94a7eb423a2cd1379541c3716475efc4 | |
parent | 1488a262bd389d0fef444bb3fd80821a2d66e6c2 (diff) | |
download | lombok-ed61012f95cefae8d03260f506ffe34bc19bd90c.tar.gz lombok-ed61012f95cefae8d03260f506ffe34bc19bd90c.tar.bz2 lombok-ed61012f95cefae8d03260f506ffe34bc19bd90c.zip |
whoops, belated push and fixes to the documentation of onX
-rw-r--r-- | buildScripts/website.ant.xml | 6 | ||||
-rw-r--r-- | usage_examples/experimental/onXExample_post.jpage (renamed from usage_examples/onXExample_post.jpage) | 0 | ||||
-rw-r--r-- | usage_examples/experimental/onXExample_pre.jpage (renamed from usage_examples/onXExample_pre.jpage) | 6 | ||||
-rw-r--r-- | website/features/Constructor.html | 2 | ||||
-rw-r--r-- | website/features/GetterSetter.html | 2 | ||||
-rw-r--r-- | website/features/experimental/Value.html | 2 | ||||
-rw-r--r-- | website/features/experimental/Wither.html | 2 | ||||
-rw-r--r-- | website/features/experimental/index.html | 10 | ||||
-rw-r--r-- | website/features/experimental/onX.html | 88 | ||||
-rw-r--r-- | website/features/onX.html | 71 |
10 files changed, 104 insertions, 85 deletions
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 @@ -146,9 +146,6 @@ such as converting the changelog into HTML, and creating javadoc. <param name="transformationName" value="Delegate" /> </antcall> <antcall target="-integrateSnippet"> - <param name="transformationName" value="onX" /> - </antcall> - <antcall target="-integrateSnippet"> <param name="transformationName" value="experimental/Accessors" /> </antcall> <antcall target="-integrateSnippet"> @@ -163,6 +160,9 @@ such as converting the changelog into HTML, and creating javadoc. <antcall target="-integrateSnippet"> <param name="transformationName" value="experimental/Value" /> </antcall> + <antcall target="-integrateSnippet"> + <param name="transformationName" value="experimental/onX" /> + </antcall> </target> <target name="-website-dist"> diff --git a/usage_examples/onXExample_post.jpage b/usage_examples/experimental/onXExample_post.jpage index 1be94f2a..1be94f2a 100644 --- a/usage_examples/onXExample_post.jpage +++ b/usage_examples/experimental/onXExample_post.jpage diff --git a/usage_examples/onXExample_pre.jpage b/usage_examples/experimental/onXExample_pre.jpage index 2cc9c581..fa03e2cd 100644 --- a/usage_examples/onXExample_pre.jpage +++ b/usage_examples/experimental/onXExample_pre.jpage @@ -7,9 +7,9 @@ import javax.persistence.Id; import javax.persistence.Column; import javax.validation.constraints.Max; -@AllArgsConstructor(onConstructor=@Inject) +@AllArgsConstructor(onConstructor=@_(@Inject)) public class OnXExample { - @Getter(onMethod={@Id, @Column(name="unique-id"}) - @Setter(onParam=@Max(10000)) + @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 <code>MapEntry.of("foo", 5)</code> instead of the much longer <code>new MapEntry<String, Integer>("foo", 5)</code>. </p><p> - To put annotations on the generated constructor, you can use <code>onConstructor={@AnnotationsHere}</code>. For more details see the documentation on the <a href="onX.html">onX</a> feature. + To put annotations on the generated constructor, you can use <code>onConstructor=@_({@AnnotationsHere})</code>, but be careful; this is an experimental feature. For more details see the documentation on the <a href="experimental/onX.html">onX</a> feature. </p><p> Static fields are skipped by these annotations. Also, a <code>@java.beans.ConstructorProperties</code> annotation is added for all constructors with at least 1 argument, which allows bean editor tools to call the generated constructors. <code>@ConstructorProperties</code> 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 <code>AccessLevel.NONE</code> access level. This lets you override the behaviour of a <code>@Getter</code>, <code>@Setter</code> or <code>@Data</code> annotation on a class. </p><p> - To put annotations on the generated method, you can use <code>onMethod={@AnnotationsHere}</code>; to put annotations on the only parameter of a generated setter method, you can use <code>onParam={@AnnotationsHere}</code>. For more details see the documentation on the <a href="onX.html">onX</a> feature. + To put annotations on the generated method, you can use <code>onMethod=@_({@AnnotationsHere})</code>; to put annotations on the only parameter of a generated setter method, you can use <code>onParam=@_({@AnnotationsHere})</code>. Be careful though! This is an experimental feature. For more details see the documentation on the <a href="experimental/onX.html">onX</a> feature. </p> </div> <div class="snippets"> 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 @@ </div> </div> <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="Wither.html">Previous feature (@Wither)</a> | <span class="disabled">Next feature</span><br /> + <a href="index.html">Back to experimental features</a> | <a href="Wither.html">Previous feature (@Wither)</a> | <a href="onX.html">Next feature (onX)</a><br /> <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2013 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> </div> <div style="clear: both;"></div> 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 @@ <code>@Wither(level = AccessLevel.PROTECTED)</code>. Also like <a href="../GetterSetter.html"><code>@Setter</code></a>, you can also put a <code>@Wither</code> annotation on a type, which means a 'wither' is generated for each field (even non-final fields). </p><p> - To put annotations on the generated method, you can use <code>onMethod={@AnnotationsHere}</code>; to put annotations on the only parameter of this method, you can use <code>onParam={@AnnotationsHere}</code>. For more details see the documentation on the <a href="onX.html">onX</a> feature. + To put annotations on the generated method, you can use <code>onMethod=@_({@AnnotationsHere})</code>; to put annotations on the only parameter of a generated wither method, you can use <code>onParam=@_({@AnnotationsHere})</code>. Be careful though! This is an experimental feature. For more details see the documentation on the <a href="onX.html">onX</a> feature. </p> </div> <div class="snippets"> 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 @@ <dl> <dt><a href="Accessors.html"><code>@Accessors</code></a></dt> <dd>A more fluent API for getters and setters.</dd> - <dt><a href="ExtensionMethod.html"><Code>@ExtensionMethod</code></a></dt> + <dt><a href="ExtensionMethod.html"><code>@ExtensionMethod</code></a></dt> <dd>Annoying API? Fix it yourself: Add new methods to existing types!</dd> - <dt><a href="FieldDefaults.html"><Code>@FieldDefaults</code></a></dt> + <dt><a href="FieldDefaults.html"><code>@FieldDefaults</code></a></dt> <dd>New default field modifiers for the 21st century.</dd> - <dt><a href="Wither.html"><Code>@Wither</code></a></dt> + <dt><a href="Wither.html"><code>@Wither</code></a></dt> <dd>Immutable 'setters' - methods that create a clone but with one changed field.</dd> - <dt><a href="Value.html"><Code>@Value</code></a></dt> + <dt><a href="Value.html"><code>@Value</code></a></dt> <dd>Immutable classes made very easy.</dd> + <dt><a href="onX.html"><code>onMethod= / onConstructor= / onParam</code></a></dt> + <dd>Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</dd> </dl> </div> <div class="footer"> diff --git a/website/features/experimental/onX.html b/website/features/experimental/onX.html new file mode 100644 index 00000000..99365deb --- /dev/null +++ b/website/features/experimental/onX.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> + <link rel="stylesheet" type="text/css" href="../features.css" /> + <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> + <meta name="description" content="Spice up your java" /> + <title>onX</title> +</head><body><div id="pepper"> + <div class="minimumHeight"></div> + <div class="meat"> + <div class="header"><a href="../../index.html">Project Lombok</a></div> + <h1>onX</h1> + <div class="byline">Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</div> + <div class="since"> + <h3>Since</h3> + <p> + onX was introduced as experimental feature in lombok v0.11.7 (<a href="/download-edge.html">edge release only</a>). + </p> + </div> + <div class="experimental"> + <h3>Experimental</h3> + <p> + Experimental because: + <ul> + <li>Ugly syntax. The syntax of this feature is not optimal, but it is the least convoluted syntax that could possibly work (for now!)</li> + <li>Possibly java 9 will offer (much) better ways of supporting this feature.</li> + <li>Uncertainty: Future versions of javac may break this feature, and we may not be able to restore it.</li> + </ul> + Current status: <em>uncertain</em> - Currently we feel this feature cannot move out of experimental status. + </div> + <div class="overview"> + <h3>Overview</h3> + <p> + <strong>This feature is considered 'workaround status' - it exists in order to allow users of lombok that cannot work without this feature to have access to it anyway. If we find a better way to implement this feature, or some future java version introduces an alternative strategy, this feature can disappear without a reasonable deprecation period. Also, this feature may not work in future versions of javac. Use at your own discretion.</strong> + </p><p> + Most annotations that make lombok generate methods or constructors can be configured to also make lombok put custom annotations on elements in the generated code. + </p><p> + <code>@Getter</code>, <code>@Setter</code>, and <code>@Wither</code> support the <code>onMethod</code> option, which will put the listed annotations on the generated method. + </p><p> + <code>@AllArgsConstructor</code>, <code>@NoArgsConstructor</code>, and <code>@RequiredArgsConstructor</code> support the <code>onConstructor</code> option which will put the listed annotations on the generated constructor. + </p><p> + <code>@Setter</code> and <code>@Wither</code> support <code>onParam</code> in addition to <code>onMethod</code>; annotations listed will be put on the only parameter that the generated method has. + </p><p> + The syntax is a little strange; to use any of the 3 <code>onX</code> features, you must wrap the annotations to be applied to the constructor / method / parameter in <code>@_(@AnnotationGoesHere)</code>. To apply multiple annotations, use <code>@_({@Annotation1, @Annotation2})</code>. The annotations can themselves obviously have parameters as well. + </p> + </div> + <div class="snippets"> + <div class="pre"> + <h3>With Lombok</h3> + <div class="snippet">@HTML_PRE@</div> + </div> + <div class="sep"></div> + <div class="post"> + <h3>Vanilla Java</h3> + <div class="snippet">@HTML_POST@</div> + </div> + </div> + <div style="clear: left;"></div> + <div class="overview"> + <h3>Small print</h3><div class="smallprint"> + <p> + The reason of the weird syntax is to make this feature work in javac 7 compilers; the <code>@_</code> type is an annotation reference to the annotation type <code>_</code> (underscore) which doesn't actually exist; this makes javac 7 delay aborting the compilation process due to an error because it is possible an annotation processor will later create the <code>_</code> type. Instead, lombok applies the annotations and removes the references so that the error will never actually occur. The point is: The <code>_</code> type <em>must not exist</em>, otherwise the feature does not work. In the rare case that the <code>_</code> type does exist (and is imported or in the package), you can simply add more underscores. Technically any non-existent type would work, but to maintain consistency and readability and catch erroneous use, lombok considers it an error if the 'wrapper' annotation is anything but a series of underscores. + </p><p> + To reiterate: This feature can disappear at any time; if you use this feature, be prepared to adjust your code when we find a nicer way of implementing this feature, or, if a future version of javac forces us to remove this feature entirely with no alternative. + </p><p> + The <code>onX</code> parameter is not legal on any type-wide variant. For example, a <code>@Getter</code> annotation on a class does not support <code>onMethod</code>. + </p> + </div> + </div> + <div class="footer"> + <a href="index.html">Back to experimental features</a> | <a href="Value.html">Previous feature (@Value)</a> | <span class="disabled">Next feature</span><br /> + <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2013 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> + </div> + <div style="clear: both;"></div> + </div> +</div> +<script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); +</script> +<script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-9884254-1"); + pageTracker._trackPageview(); + } catch(err) {} +</script> +</body></html> diff --git a/website/features/onX.html b/website/features/onX.html deleted file mode 100644 index ab72e6f5..00000000 --- a/website/features/onX.html +++ /dev/null @@ -1,71 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="features.css" /> - <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>onX</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../index.html">Project Lombok</a></div> - <h1>onX</h1> - <div class="byline">Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</div> - <div class="overview"> - <h3>Overview</h3> - <p> - <strong>This feature is considered 'workaround status' - it exists in order to allow users of lombok that cannot work without this feature to have access to it anyway. If we find a better way to implement this feature, or some future java version introduces an alternative strategy, this feature can disappear without a reasonable deprecation period. Also, this feature may not work in future versions of javac. Use at your own discretion.</strong> - </p><p> - Most annotations that make lombok generate methods or constructors can be configured to also - make lombok put custom annotations on elements in the generated code. - </p><p> - <code>@Getter</code>, <code>@Setter</code>, and <code>@Wither</code> support the <code>onMethod</code> - option, which will put the listed annotations on the generated method. - </p><p> - <code>@AllArgsConstructor</code>, <code>@NoArgsConstructor</code>, and <code>@RequiredArgsConstructor</code> support the <code>onConstructor</code> option which will put the listed annotations on the generated constructor. - </p><p> - <code>@Setter</code> and <code>@Wither</code> support <code>onParam</code> in addition to <code>onMethod</code>; annotations listed will be put on the only parameter that the generated method has. - </p><p> - None of the mentioned annotations above actually have parameters named <code>onMethod</code>, <code>onParam</code>, or <code>onConstructor</code>; nevertheless, if you type them, lombok will make it work. Unfortunately this does mean that auto-complete and other tool-driven convenience features will not work as expected. The annotations lack these parameters in order to work around javac limitations. - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - We can't think of any small print for this feature, other than to reiterate: This feature can disappear at any time; if you use this feature, be prepared to adjust your code when we find a nicer way of implementing this feature, or, if a future version of javac forces us to remove this feature entirely with no alternative. - </p><p> - The <code>onX</code> parameter is not legal on any type-wide variant. For example, a <code>@Getter</code> annotation on a class does not support <code>onMethod</code>. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to features</a><br /> - <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2013 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> |