mirror of
https://github.com/tiennm99/lombok.git
synced 2026-05-27 20:25:27 +00:00
91 lines
6.0 KiB
HTML
91 lines
6.0 KiB
HTML
<!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>Lombok feature overview</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>Lombok features</h1>
|
|
<div class="index overview">
|
|
<dl>
|
|
<dt><a href="val.html"><code>val</code></a></dt>
|
|
<dd>Finally! Hassle-free final local variables.</dd>
|
|
<dt><a href="NonNull.html"><code>@NonNull</code></a></dt>
|
|
<dd>or: How I learned to stop worrying and love the NullPointerException.</dd>
|
|
<dt><a href="Cleanup.html"><code>@Cleanup</code></a></dt>
|
|
<dd>Automatic resource management: Call your <code>close()</code> methods safely with no hassle.</dd>
|
|
<dt><a href="GetterSetter.html"><code>@Getter</code> / <code>@Setter</code></a></dt>
|
|
<dd>Never write <code>public int getFoo() {return foo;}</code> again.</dd>
|
|
<dt><a href="ToString.html"><code>@ToString</code></a></dt>
|
|
<dd>No need to start a debugger to see your fields: Just let lombok generate a <code>toString</code> for you!</dd>
|
|
<dt><a href="EqualsAndHashCode.html"><code>@EqualsAndHashCode</code></a></dt>
|
|
<dd>Equality made easy: Generates <code>hashCode</code> and <code>equals</code> implementations from the fields of your object.</dd>
|
|
<dt><a href="Constructor.html"><code>@NoArgsConstructor</code>, <code>@RequiredArgsConstructor</code> and <code>@AllArgsConstructor</code></a></dt>
|
|
<dd>Constructors made to order: Generates constructors that take no arguments, one argument per final / non-null field, or one argument for every field.</dd>
|
|
<dt><a href="Data.html"><code>@Data</code></a></dt>
|
|
<dd>All together now: A shortcut for <code>@ToString</code>, <code>@EqualsAndHashCode</code>,
|
|
<code>@Getter</code> on all fields, and <code>@Setter</code> on all non-final fields, and <code>@RequiredArgsConstructor</code>!</dd>
|
|
<dt><a href="Value.html"><code>@Value</code></a></dt>
|
|
<dd>Immutable classes made very easy.</dd>
|
|
<dt><a href="Builder.html"><code>@Builder</code></a></dt>
|
|
<dd>... and Bob's your uncle: No-hassle fancy-pants APIs for object creation!</dd>
|
|
<dt><a href="SneakyThrows.html"><code>@SneakyThrows</code></a></dt>
|
|
<dd>To boldly throw checked exceptions where no one has thrown them before!</dd>
|
|
<dt><a href="Synchronized.html"><code>@Synchronized</code></a></dt>
|
|
<dd><code>synchronized</code> done right: Don't expose your locks.</dd>
|
|
<dt><a href="GetterLazy.html"><code>@Getter(lazy=true)</code></a></dt>
|
|
<dd>Laziness is a virtue!</dd>
|
|
<dt><a href="Log.html"><code>@Log</code></a></dt>
|
|
<dd>Captain's Log, stardate 24435.7: "What was that line again?"</dd>
|
|
<dt><a href="configuration.html">Configuration system</a></dt>
|
|
<dd>Lombok, made to order: Configure lombok features in one place for your entire project or even your workspace.</dd>
|
|
<dt><a href="experimental/index.html">Experimental features</a></dt>
|
|
<dd>Here be dragons: Extra features which aren't quite ready for prime time yet.</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="pointer">
|
|
If you'd rather read a longer tutorial, <a href="http://jnb.ociweb.com/jnb/jnbJan2010.html">here is a great tutorial (including a walkthrough through some of the above features)</a> written by Michael Kimberlin.
|
|
</div>
|
|
<div class="pointer">
|
|
The documentation above is a lot easier to follow, but if you want to build your own transformations,
|
|
or you want to add javadoc to <code>lombok.jar</code> in your IDE, you can also check out <a href="../api/index.html">the javadoc</a>.
|
|
</div>
|
|
<h1>Running Lombok</h1>
|
|
<h3>On eclipse</h3>
|
|
Execute lombok.jar (doubleclick it, or run java -jar lombok.jar). Follow instructions.
|
|
<h3>On javac (and maven, ant, and other build tools)</h3>
|
|
Include lombok.jar on the classpath as you compile. That's all there is to it!<br />
|
|
Lombok hosts its own maven repository, so adding lombok to maven is very simple. <a href="/mavenrepo/index.html">full instructions are here</a>.
|
|
<h3>On GWT (Google Widget Toolkit)</h3>
|
|
See <a href="../setup/gwt.html">gwt</a> setup.
|
|
<h3>On javadoc, and other source-based tools</h3>
|
|
Use <a href="delombok.html">delombok</a> first, then run javadoc or GWT on the delombok-ed code.
|
|
<h1>Running delombok</h1>
|
|
<div>Delombok copies your source files to another directory, replacing all lombok annotations with their desugared form. So, it'll turn <code>@Getter</code>
|
|
back into the actual getter. It then removes the annotation. This is useful for all sorts of reasons; you can check out what's happening under the hood,
|
|
if the unthinkable happens and you want to stop using lombok, you can easily remove all traces of it in your source, and you can use delombok to preprocess
|
|
your source files for source-level tools such as javadoc and GWT. More information about how to run delombok, including instructions for build tools
|
|
can be found at the <a href="delombok.html">delombok page</a>.</div>
|
|
<div class="footer">
|
|
<a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2015 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>
|