diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-10-18 16:01:01 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-10-18 20:24:38 +0200 |
commit | 13d84b129e562fdc71b049778c3b3bd2376e29a4 (patch) | |
tree | 3fac6ce541f79a11437c8d89274d47f9a9e509c4 | |
parent | dbc67c5c2d0388692f9c9dec02b294da14fd5b56 (diff) | |
download | lombok-13d84b129e562fdc71b049778c3b3bd2376e29a4.tar.gz lombok-13d84b129e562fdc71b049778c3b3bd2376e29a4.tar.bz2 lombok-13d84b129e562fdc71b049778c3b3bd2376e29a4.zip |
[#2693] Docs and changelog for the ‘accessors.capitalization = beanspec’ feature.
-rw-r--r-- | doc/changelog.markdown | 2 | ||||
-rw-r--r-- | website/templates/features/GetterSetter.html | 5 | ||||
-rw-r--r-- | website/templates/features/With.html | 9 | ||||
-rw-r--r-- | website/templates/features/experimental/Accessors.html | 12 |
4 files changed, 24 insertions, 4 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 6f9adbac..cd8a4353 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -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). diff --git a/website/templates/features/GetterSetter.html b/website/templates/features/GetterSetter.html index a429c9ac..8b16d34d 100644 --- a/website/templates/features/GetterSetter.html +++ b/website/templates/features/GetterSetter.html @@ -38,6 +38,11 @@ </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> Lombok will flag any usage of <code>@Setter</code> as a warning or error if configured. diff --git a/website/templates/features/With.html b/website/templates/features/With.html index 8b34f038..867c17eb 100644 --- a/website/templates/features/With.html +++ b/website/templates/features/With.html @@ -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> diff --git a/website/templates/features/experimental/Accessors.html b/website/templates/features/experimental/Accessors.html index 564ab66d..9a9385cb 100644 --- a/website/templates/features/experimental/Accessors.html +++ b/website/templates/features/experimental/Accessors.html @@ -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> @@ -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> @@ -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> @@ -64,6 +65,11 @@ </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> Lombok will flag any usage of <code>@Accessors</code> as a warning or error if configured. |