Skip to content

Commit

Permalink
[#2693] Docs and changelog for the ‘accessors.capitalization = beansp…
Browse files Browse the repository at this point in the history
…ec’ feature.
  • Loading branch information
rzwitserloot committed Oct 18, 2021
1 parent dbc67c5 commit 13d84b1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/changelog.markdown
Expand Up @@ -2,7 +2,7 @@ Lombok Changelog
----------------

### v1.18.24 "Edgy Guinea Pig"
* No new changes since the release of v1.18.22.
* FEATURE: Turning a field named `uShape` into a getter is tricky: `getUShape` or `getuShape`? The community is split on which style to use. Lombok does `getUShape`, but if you prefer the `getuShape` style, add to `lombok.config`: `lombok.accessors.capitalization = beanspec`. [Issue #2693](https://github.com/projectlombok/lombok/issues/2693) [Pull Request #2996](https://github.com/projectlombok/lombok/pull/2996). Thanks __@YonathanSherwin__!

### v1.18.22 (October 6th, 2021)
* PLATFORM: JDK17 support added. [Issue #2898](https://github.com/projectlombok/lombok/issues/2898).
Expand Down
5 changes: 5 additions & 0 deletions website/templates/features/GetterSetter.html
Expand Up @@ -37,6 +37,11 @@
<code>lombok.getter.noIsPrefix</code> = [<code>true</code> | <code>false</code>] (default: false)
</dt><dd>
If set to <code>true</code>, getters generated for <code>boolean</code> fields will use the <code>get</code> prefix instead of the default<code>is</code> prefix, and any generated code that calls getters, such as <code>@ToString</code>, will also use <code>get</code> instead of <code>is</code>
</dd><dt>
<code>lombok.accessors.capitalization</code> = [<code>basic</code> | <code>beanspec</code>] (default: basic)
</dt><dd>
Controls how tricky cases like <code>uShaped</code> (one lowercase letter followed by an upper/titlecase letter) are capitalized. <code>basic</code> capitalizes that to <code>getUShaped</code>, and <code>beanspec</code> capitalizes that to <code>getuShaped</code> instead.<br />
Both strategies are commonly used in the java ecosystem, though <code>beanspec</code> is more common.
</dd><dt>
<code>lombok.setter.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Expand Down
9 changes: 9 additions & 0 deletions website/templates/features/With.html
Expand Up @@ -27,6 +27,15 @@
<@f.snippets name="With" />

<@f.confKeys>
<><dt>
<code>lombok.accessors.prefix</code> += <em>a field prefix</em> (default: empty list)
</dt><dd>
This is a list property; entries can be added with the <code>+=</code> operator. Inherited prefixes from parent config files can be removed with the <code>-=</code> operator. Lombok will strip any matching field prefix from the name of a field in order to determine the name of the getter/setter to generate. For example, if <code>m</code> is one of the prefixes listed in this setting, then a field named <code>mFoobar</code> will result in a getter named <code>getFoobar()</code>, not <code>getMFoobar()</code>. An explicitly configured <code>prefix</code> parameter of an <a href="/features/experimental/Accessors"><code>@Accessors</code></a> annotation takes precedence over this setting.
</dd><dt>
<code>lombok.accessors.capitalization</code> = [<code>basic</code> | <code>beanspec</code>] (default: basic)
</dt><dd>
Controls how tricky cases like <code>uShaped</code> (one lowercase letter followed by an upper/titlecase letter) are capitalized. <code>basic</code> capitalizes that to <code>withUShaped</code>, and <code>beanspec</code> capitalizes that to <code>withuShaped</code> instead.<br />
Both strategies are commonly used in the java ecosystem, though <code>beanspec</code> is more common.
<dt>
<code>lombok.with.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Expand Down
12 changes: 9 additions & 3 deletions website/templates/features/experimental/Accessors.html
Expand Up @@ -4,9 +4,11 @@
<@f.history>
<p>
<code>@Accessors</code> was introduced as experimental feature in lombok v0.11.0.
</p><p>
The <em>lombok.config</em> option <code>lombok.accessors.capitalization</code> = [<code>basic</code> | <code>beanspec</code>] was added in lombok v1.18.24.
</p>
</@f.history>

<@f.experimental>
<ul>
<li>
Expand All @@ -17,7 +19,6 @@
</ul>
Current status: <em>neutral</em> - Some changes are expected. These changes are intended to be backwards compatible, but should start in an experimental feature:
<ul>
<li>Open feature request: naming behaviour for properties that start with a lowercase letter followed by an uppercase letter. Half of specs, tools and lombok users prefer that a field named <code>uLimit</code> into <code>getULimit</code> (including lombok) and the other half turn prefer <code>getuLimit</code>. <code>@Accessors</code> may be involved in any update that addresses this <a href="https://github.com/projectlombok/lombok/issues/2693">request</a>.</li>
<li>Open feature request: More control over naming accessors; for example to address creatively named boolean properties: Turn <code>boolean wasRunning</code> into <code>boolean wasRunning()</code> instead of <code>boolean isWasRunning()</code>, as well as more expansive prefix support. <code>@Accessors</code> will be involved if this feature <a href="https://github.com/projectlombok/lombok/issues/2464">request</a> is addressed.</li>
<li><code>@Accessors</code> currently does not 'cascade' from field <code>@Accessors</code> annotation to the class-level <code>@Accessors</code> annotation, but it does 'cascade' to <code>lombok.config</code>. Changing this is not difficult but backwards incompatible. It's not likely to break much existing code, but this needs to be decided on before the feature can move out of <em>experimental</em> status.</li>
</ul>
Expand All @@ -44,7 +45,7 @@
</li>
</ul>
<p><p>
The <code>@Accessors</code> annotation is legal on types and fields; the annotation that applies is the one on the field if present, otherwise the one on the class. When a <code>@Accessors</code> annotation on a field is present, any <code>@Accessors</code> annotation also present on the class the field is in, is entirely ignored, <em>even for properties not configured on the field <code>@Accessors</code></em>. This in contrast to any <code>lombok.config</code> configuration keys which serve as fall-back default if any explicit <code>@Accessors</code> annotation doesn't specify.
The <code>@Accessors</code> annotation is legal on types and fields; the annotation that applies is the one on the field if present, otherwise the one on the class. When an <code>@Accessors</code> annotation on a field is present, any <code>@Accessors</code> annotation also present on the class the field is in, is entirely ignored, <em>even for properties not configured on the field <code>@Accessors</code></em>. This in contrast to any <code>lombok.config</code> configuration keys which serve as fall-back default if any explicit <code>@Accessors</code> annotation doesn't specify.
</p>
</@f.overview>

Expand All @@ -63,6 +64,11 @@
<code>lombok.accessors.prefix</code> += <em>a field prefix</em> (default: empty list)
</dt><dd>
This is a list property; entries can be added with the <code>+=</code> operator. Inherited prefixes from parent config files can be removed with the <code>-=</code> operator. Any class that either doesn't have an <code>@Accessors</code> annotation, or it does, but that annotation does not have an explicit value for the <code>prefix</code> parameter, will act as if <code>@Accessors(prefix = {<em>prefixes listed in configuration</em>})</code> is present.
</dd><dt>
<code>lombok.accessors.capitalization</code> = [<code>basic</code> | <code>beanspec</code>] (default: basic)
</dt><dd>
Controls how tricky cases like <code>uShaped</code> (one lowercase letter followed by an upper/titlecase letter) are capitalized. <code>basic</code> capitalizes that to <code>getUShaped</code>, and <code>beanspec</code> capitalizes that to <code>getuShaped</code> instead.<br />
Both strategies are commonly used in the java ecosystem, though <code>beanspec</code> is more common.
</dd><dt>
<code>lombok.accessors.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Expand Down

0 comments on commit 13d84b1

Please sign in to comment.