aboutsummaryrefslogtreecommitdiff
path: root/website/templates/features/GetterLazy.html
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-10-15 21:19:18 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-10-15 21:19:18 +0200
commitd994839ac0255fa08d201df4e2918434f946b06f (patch)
tree713f9fcae19be150804e715a9fa414117287d17d /website/templates/features/GetterLazy.html
parentc2f4ea47a16b38391928eaca32b23d3b1d4041fb (diff)
parentcbcab664805916d8a7e6ee53c1df5a454611f99e (diff)
downloadlombok-d994839ac0255fa08d201df4e2918434f946b06f.tar.gz
lombok-d994839ac0255fa08d201df4e2918434f946b06f.tar.bz2
lombok-d994839ac0255fa08d201df4e2918434f946b06f.zip
Merge branch 'master' into janrieke-superToBuilder
Diffstat (limited to 'website/templates/features/GetterLazy.html')
-rw-r--r--website/templates/features/GetterLazy.html3
1 files changed, 3 insertions, 0 deletions
diff --git a/website/templates/features/GetterLazy.html b/website/templates/features/GetterLazy.html
index b1f374a8..e921712c 100644
--- a/website/templates/features/GetterLazy.html
+++ b/website/templates/features/GetterLazy.html
@@ -9,6 +9,9 @@
<p>
You can let lombok generate a getter which will calculate a value once, the first time this getter is called, and cache it from then on. This can be useful if calculating the value takes a lot of CPU, or the value takes a lot of memory. To use this feature, create a <code>private final</code> variable, initialize it with the expression that's expensive to run, and annotate your field with <code>@Getter(lazy=true)</code>. The field will be hidden from the rest of your code, and the expression will be evaluated no more than once, when the getter is first called. There are no magic marker values (i.e. even if the result of your expensive calculation is <code>null</code>, the result is cached) and your expensive calculation need not be thread-safe, as lombok takes care of locking.
</p>
+ <p>
+ If the initialization expression is complex, or contains generics, we recommend moving the code to a private (if possible static) method, and call that instead.
+ </p>
</@f.overview>
<@f.snippets name="GetterLazy" />