diff options
-rw-r--r-- | buildScripts/website.ant.xml | 3 | ||||
-rw-r--r-- | usage_examples/onXExample_post.jpage | 41 | ||||
-rw-r--r-- | usage_examples/onXExample_pre.jpage | 23 | ||||
-rw-r--r-- | website/features/Delegate.html | 2 | ||||
-rw-r--r-- | website/features/index.html | 2 | ||||
-rw-r--r-- | website/features/onX.html | 58 |
6 files changed, 128 insertions, 1 deletions
diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index aabc337c..68e20eae 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -144,6 +144,9 @@ such as converting the changelog into HTML, and creating javadoc. <antcall target="-integrateSnippet"> <param name="transformationName" value="Delegate" /> </antcall> + <antcall target="-integrateSnippet"> + <param name="transformationName" value="onX" /> + </antcall> </target> <target name="-website-dist"> diff --git a/usage_examples/onXExample_post.jpage b/usage_examples/onXExample_post.jpage new file mode 100644 index 00000000..f71f16a3 --- /dev/null +++ b/usage_examples/onXExample_post.jpage @@ -0,0 +1,41 @@ +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +public class OnMethodOnParamExample { + private int fires = 200; + private int firemen = 20; + private String fireStationName = "base"; + + @Deprecated + public int getFires() { + return fires; + } + + @Deprecated + public void setFiremen(int firemen) { + this.firemen = firemen; + } + + public void setFireStationName(@SuppressWarnings("all") int fireStationName) { + this.fireStationName = fireStationName; + } + + @Override public String toString() { + return String.format("firestation:%s, %d firemen are fighting %d fires", fireStationName, firemen, fires); + } +} + +class OnConstructorExample { + private final int radishes; + private int bananas; + + @Deprecated + public OnConstructorExample(int radishes) { + this.radishes = radishes; + } + + @Override public String toString() { + return String.format("I have %d bananas and %d radishes", bananas, radishes); + } +}
\ No newline at end of file diff --git a/usage_examples/onXExample_pre.jpage b/usage_examples/onXExample_pre.jpage new file mode 100644 index 00000000..3e91fb3a --- /dev/null +++ b/usage_examples/onXExample_pre.jpage @@ -0,0 +1,23 @@ +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +public class OnMethodOnParamExample { + @Getter(onMethod=@Deprecated) private int fires = 200; + @Setter(onMethod=@Deprecated) private int firemen = 20; + @Setter(onParam=@SuppressWarnings("all")) private String fireStationName = "base"; + + @Override public String toString() { + return String.format("firestation:%s, %d firemen are fighting %d fires", fireStationName, firemen, fires); + } +} + +@RequiredArgsConstructor(onConstructor=@Deprecated) +class OnConstructorExample { + private final int radishes; + private int bananas; + + @Override public String toString() { + return String.format("I have %d bananas and %d radishes", bananas, radishes); + } +}
\ No newline at end of file diff --git a/website/features/Delegate.html b/website/features/Delegate.html index bdb22c26..52b1035d 100644 --- a/website/features/Delegate.html +++ b/website/features/Delegate.html @@ -51,7 +51,7 @@ <div> </div> <div class="footer"> - <a href="index.html">Back to features</a> | <a href="val.html">Previous feature (val)</a> | <span class="disabled">Next feature</span><br /> + <a href="index.html">Back to features</a> | <a href="val.html">Previous feature (val)</a> | <a href="onX.html">Next feature (onMethod=,onParameter=,onConstructor=)</a><br /> <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2010-2011 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, 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/index.html b/website/features/index.html index 06b6763e..e9a2255b 100644 --- a/website/features/index.html +++ b/website/features/index.html @@ -38,6 +38,8 @@ <dd>Finally! hassle-free final local variables.</dd> <dt><a href="Delegate.html"><code>@Delegate</code></a></dt> <dd>Don't lose your composition</dd> + <dt><a href="onX.html"><code>onMethod=,onParam=,onConstructor=</code></a></dt> + <dd>Annotate this! Add you favorite annotation to methods generated by lombok.</dd> </dl> </div> <div class="pointer"> diff --git a/website/features/onX.html b/website/features/onX.html new file mode 100644 index 00000000..b94dea4b --- /dev/null +++ b/website/features/onX.html @@ -0,0 +1,58 @@ +<!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>onMethod=,onParam=,onConstructor=</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>onMethod=,onParam=,onConstructor=</h1> + <div class="byline">Annotate this! Add you favorite annotation to methods generated by lombok.</div> + <div class="overview"> + <h3>Overview</h3> + <p> + Lombok lets you add your favorite annotation to methods generated by <code>@Getter</code> and <code>@Setter</code> by using the attribute <code>onMethod</code> + on the lombok annotation. You can specify annotations to the parameters of the method on <code>@Setter</code> with the attribute <code>onParameter</code>. + You can add annotation to constructors generated by <code>@NoArgsConstructor, @RequiredArgsConstructor and @AllArgsConstructor</code> by using the attribute + <code>onConstructor</code> + </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"> + When the @Getter or @Setter annotation is placed on the type in stead of a field, using the attribute is not supported and it will result in a warning. + </div> + </div> + <div class="footer"> + <a href="index.html">Back to features</a> | <a href="Delegate.html">Previous feature (@Delegate)</a> | <span class="disabled">Next feature</span><br /> + <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2011 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, 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> |