-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.html
231 lines (170 loc) · 12.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="keywords" content="java,immutable,object,generate,annotation,mongo,mongodb">
<meta name="description" content="Java toolkit based around usage of immutable objects and fluent interfaces">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"-->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css">
<link rel="stylesheet" href="/gfx/bootstrap.min.css">
<link rel="stylesheet" href="/gfx/main.css">
<link rel="stylesheet" href="/gfx/code.css">
<title>Immutables.org</title>
</head>
<body>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-PMJSKV"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PMJSKV');</script>
<!-- End Google Tag Manager -->
<header class="jumbotron">
<div class="container">
<h1 title="The Immutables Java Annotation Processor v2.10.1">Immutables
<iframe src="https://ghbtns.com/github-btn.html?user=immutables&repo=immutables&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
</h1>
<p>Java annotation processors to generate simple, safe and consistent value objects. Do not repeat yourself, try Immutables, the most comprehensive tool in this field!</p>
<a href="/getstarted.html" class="btn btn-primary btn-lg">Get started!</a>
<a href="/immutable.html" class="btn btn-default btn-lg">Read guide...</a>
<span class="label label-info" style="cursor: pointer" title="Current stable version jar" onclick="location.href='https://search.maven.org/artifact/org.immutables/value/2.10.1/jar'">v2.10.1</span>
<!--<a href="https://twitter.com/ImmutablesOrg" class="pull-right">
<i class="fa fa-twitter"></i> News and announcements</a>-->
</div>
</header>
<section class="illustration sample0 clearfix">
<div class="container clearfix">
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">org.immutables.value.Value</span><span class="o">;</span>
<span class="c1">// Define abstract value type</span>
<span class="nd">@Value</span><span class="o">.</span><span class="na">Immutable</span>
<span class="kd">public</span> <span class="kd">interface</span> <span class="nc">ValueObject</span> <span class="o">{</span>
<span class="nc">String</span> <span class="nf">name</span><span class="o">();</span>
<span class="nc">List</span><span class="o"><</span><span class="nc">Integer</span><span class="o">></span> <span class="nf">counts</span><span class="o">();</span>
<span class="nc">Optional</span><span class="o"><</span><span class="nc">String</span><span class="o">></span> <span class="nf">description</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Use generated immutable implementation</span>
<span class="nc">ValueObject</span> <span class="n">valueObject</span> <span class="o">=</span>
<span class="nc">ImmutableValueObject</span><span class="o">.</span><span class="na">builder</span><span class="o">()</span>
<span class="o">.</span><span class="na">name</span><span class="o">(</span><span class="s">"My value"</span><span class="o">)</span>
<span class="o">.</span><span class="na">addCounts</span><span class="o">(</span><span class="mi">1</span><span class="o">)</span>
<span class="o">.</span><span class="na">addCounts</span><span class="o">(</span><span class="mi">2</span><span class="o">)</span>
<span class="o">.</span><span class="na">build</span><span class="o">();</span>
</code></pre></div></div>
</div>
<div class="container clearfix">
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Or you can configure different @Value.Style</span>
<span class="nd">@Value</span><span class="o">.</span><span class="na">Immutable</span>
<span class="kd">abstract</span> <span class="kd">class</span> <span class="nc">AbstractItem</span> <span class="o">{</span>
<span class="kd">abstract</span> <span class="nc">String</span> <span class="nf">getName</span><span class="o">();</span>
<span class="kd">abstract</span> <span class="nc">Set</span><span class="o"><</span><span class="nc">String</span><span class="o">></span> <span class="nf">getTags</span><span class="o">();</span>
<span class="kd">abstract</span> <span class="nc">Optional</span><span class="o"><</span><span class="nc">String</span><span class="o">></span> <span class="nf">getDescription</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Use generated value object</span>
<span class="nc">Item</span> <span class="n">namelessItem</span> <span class="o">=</span> <span class="nc">Item</span><span class="o">.</span><span class="na">builder</span><span class="o">()</span>
<span class="o">.</span><span class="na">setName</span><span class="o">(</span><span class="s">"Nameless"</span><span class="o">)</span>
<span class="o">.</span><span class="na">addTags</span><span class="o">(</span><span class="s">"important"</span><span class="o">,</span> <span class="s">"relevant"</span><span class="o">)</span>
<span class="o">.</span><span class="na">setDescription</span><span class="o">(</span><span class="s">"Description provided"</span><span class="o">)</span>
<span class="o">.</span><span class="na">build</span><span class="o">();</span>
<span class="nc">Item</span> <span class="n">namedValue</span> <span class="o">=</span> <span class="n">namelessItem</span><span class="o">.</span><span class="na">withName</span><span class="o">(</span><span class="s">"Named"</span><span class="o">);</span>
</code></pre></div></div>
</div>
</section>
<section class="promo jumbotron">
<div class="container clearfix">
<section class="feature">
<h4 id="values-and-builders">Values and Builders</h4>
<p>With <em>Immutables</em> you can generate state of the art immutable objects and builders.
Type-safe, null-safe and thread-safe, with no boilerplate. Generate builders for <a href="/immutable.html">immutable objects</a> and even plain static <a href="/factory.html">factory methods</a>.</p>
</section>
<section class="feature">
<!-- <span class="label label-success" title="No required dependencies. Both Guava and JDK collections are supported">2.0</span> -->
<h4 id="easy-to-use">Easy to use</h4>
<p>Just add jar to classpath and use. No required runtime dependencies!
Guava is supported, but not required.
Works out-of-the box with build tools, integrates into <a href="/apt.html">IDEs</a>. <a href="/getstarted.html">Get started!</a></p>
</section>
<section class="feature">
<!--<span class="label label-success" title="@Value.Redacted annotation">2.5.0</span>-->
<h4 id="feature-packed">Feature packed</h4>
<p>Lazy, derived and optional attributes. Comprehensive support for collections as attributes, including Guava collections. Generic parameters. Copy with structural sharing. Singleton and interned instances… <a href="/immutable.html">and more!</a></p>
</section>
<section class="feature">
<h4 id="clean-code">Clean code</h4>
<p><em>Immutables</em> has much higher standards for code readability than other generators.
Generated APIs are carefully tuned for the best power-to-weight ratio. No ugly named identifiers. Implementation code is clear, efficient, and have corresponding javadocs. <a href="/generated.html">Take a look</a></p>
</section>
<section class="feature">
<!--<span class="label label-success" title="Experimental encodings">Encodings</span>-->
<h4 id="flexible">Flexible</h4>
<p>Adapt Immutables to your code conventions and tastes. <a href="/style.html">Customize</a> <code class="language-plaintext highlighter-rouge">get</code>, <code class="language-plaintext highlighter-rouge">set</code>, <code class="language-plaintext highlighter-rouge">with</code> or whatever prefixes. Describe styles as reusable meta-annotations. Generate as much or as little as you need, expose or hide generated classes. Go rogue with <a href="/encoding.html">Encodings</a> to implement custom attribute types!</p>
</section>
<section class="feature">
<h4 id="json">JSON</h4>
<p>Immutables are <a href="/immutable.html#serialization">serialization</a> ready, including JSON and its binary forms. <em>Jackson</em> and <em>Gson</em> libraries are supported. Gson is integrated using generated <a href="/typeadapters.html">TypeAdapters</a> which use no reflection. <a href="/json.html">JSON guide</a>. <a href="/mongo.html">MongoDB</a> repositories also included.</p>
</section>
<section class="feature">
<!--<span class="label label-warning" title="Experimental criteria">new</span>-->
<h4 id="criteria">Criteria</h4>
<p>Generate typesafe <a href="/criteria.html">query and repository DSL</a> to access different datasources.</p>
</section>
<br>
</div>
</section>
<div class="text-center container">
<!--hr-->
<span class="badge alert-info">Classes, Interfaces and Annotations</span>
<span class="badge alert-info">Builders</span>
<span class="badge alert-info">Constuctor methods</span>
<span class="badge alert-info">With-copy methods</span>
<span class="badge alert-info">equals, toString, hashCode methods</span>
<span class="badge alert-info">Default attributes</span>
<span class="badge alert-info">Derived attributes</span>
<span class="badge alert-info">Lazy attributes</span>
<span class="badge alert-info">Optional attributes</span>
<span class="badge alert-info">Array, List, Set and Map attributes</span>
<span class="badge alert-info">Singleton values</span>
<span class="badge alert-info">Instance interning</span>
<span class="badge alert-info">hashCode precomputing</span>
<span class="badge alert-info">JSON serialization</span>
<span class="badge alert-info">JAX-RS integration</span>
<span class="badge alert-info">MongoDB integration</span>
<span class="badge alert-info">Query DSL</span>
<br>
</div>
<footer class="jumbotron">
<div class="container">
<h2 id="guides">Guides</h2>
<ul>
<li><a href="/getstarted.html">Get started!</a></li>
<li><a href="/intro.html">Inception</a></li>
<li><a href="/immutable.html">Immutable objects</a></li>
<li><a href="/factory.html">Factory builders</a></li>
<li><a href="/functional.html">Functions and Predicates (for Java 7)</a></li>
<li><a href="/style.html">Style customization</a></li>
<li><a href="/json.html">JSON serialization</a></li>
<li><a href="/criteria.html">Criteria</a></li>
<li><a href="/mongo.html">MongoDB repositories</a></li>
<li><a href="/dynamodb.html">DynamoDB integration</a></li>
<li><a href="/encoding.html">Encoding: Customizing attributes and builders (experimental)</a></li>
<li><a href="/apt.html">Using annotation processor in IDE</a></li>
</ul>
<h2 id="get-involved">Get involved</h2>
<ul>
<li>Clone source repository, contribute bug reports and fixes on <a href="https://github.com/immutables/immutables">GitHub immutables/immutables</a></li>
<li>Issue reports, questions and feedback is welcome on issue tracker <a href="https://github.com/immutables/immutables/issues">GitHub immutables/immutables/issues</a></li>
<li>News and announcements on twitter <a href="https://twitter.com/ImmutablesOrg">@ImmutablesOrg</a></li>
</ul>
<p><a href="/license.html">Apache License 2.0</a></p>
</div>
<!-- <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/ImmutablesOrg" data-widget-id="423956242294267904">Tweets by @ImmutablesOrg</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
-->
</footer>
</body>
</html>