aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-06-01 11:01:58 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-06-01 11:01:58 +0200
commit627de194c03af3afa3478149dc777d2af4e9654b (patch)
tree21d0604c96f27ded461e6d396d8f64b2a2945211
parentfe25bb153326d657ad98d9bd55c801d8815f39b3 (diff)
downloadlombok-627de194c03af3afa3478149dc777d2af4e9654b.tar.gz
lombok-627de194c03af3afa3478149dc777d2af4e9654b.tar.bz2
lombok-627de194c03af3afa3478149dc777d2af4e9654b.zip
fixed up ‘consequent boolean’ proposal with a different key name and documentation.
-rw-r--r--src/core/lombok/ConfigurationKeys.java8
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java1
-rw-r--r--website/features/GetterSetter.html22
3 files changed, 12 insertions, 19 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index e3308f0a..301563b8 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -112,12 +112,12 @@ public class ConfigurationKeys {
public static final ConfigurationKey<FlagUsageType> GETTER_LAZY_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.getter.lazy.flagUsage", "Emit a warning or error if @Getter(lazy=true) is used.") {};
/**
- * lombok configuration: {@code lombok.getter.consequentBoolean} = {@code true} | {@code false}.
- *
- * If true, the special Javabeans rules for {@code boolean} accessors get ignored and booleans get processed just like any other type.
+ * lombok configuration: {@code lombok.getter.noIsPrefix} = {@code true} | {@code false}.
+ *
+ * If {@code true}, booleans getters are both referred to, and generated as {@code getFieldName()}. If {@code false} (the default), the javabean-standard {@code isFieldName()} is generated / used instead.
*
*/
- public static final ConfigurationKey<Boolean> GETTER_CONSEQUENT_BOOLEAN = new ConfigurationKey<Boolean>("lombok.getter.consequentBoolean", "Emit a warning or error if @Getter is used.") {};
+ public static final ConfigurationKey<Boolean> GETTER_CONSEQUENT_BOOLEAN = new ConfigurationKey<Boolean>("lombok.getter.noIsPrefix", "If true, generate and use getFieldName() for boolean getters instead of isFieldName().") {};
// ----- Setter -----
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index 03bb341c..621d8760 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -285,7 +285,6 @@ public class HandlerUtil {
if (Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.GETTER_CONSEQUENT_BOOLEAN))) isBoolean = false;
boolean explicitPrefix = accessors != null && accessors.isExplicit("prefix");
-// System.out.printf("accessors: %s actual expr: %s val: %s\n", accessors, accessors != null ? accessors.getActualExpression("prefix") : "(null)", accessors == null ? "(null)" : Arrays.toString(accessors.getInstance().prefix()));
boolean explicitFluent = accessors != null && accessors.isExplicit("fluent");
Accessors ac = (explicitPrefix || explicitFluent) ? accessors.getInstance() : null;
diff --git a/website/features/GetterSetter.html b/website/features/GetterSetter.html
index a0da405d..ad83f86a 100644
--- a/website/features/GetterSetter.html
+++ b/website/features/GetterSetter.html
@@ -16,18 +16,13 @@
<h3>Overview</h3>
<p>
You can annotate any field with <code>@Getter</code> and/or <code>@Setter</code>, to let lombok generate the default getter/setter automatically.<br />
- A default getter simply returns the field, and is named <code>getFoo</code> if the field is called <code>foo</code> (or <code>isFoo</code>
- if the field's type is <code>boolean</code>). A default setter is named <code>setFoo</code> if the field is called <code>foo</code>, returns <code>void</code>,
- and takes 1 parameter of the same type as the field. It simply sets the field to this value.
+ A default getter simply returns the field, and is named <code>getFoo</code> if the field is called <code>foo</code> (or <code>isFoo</code> if the field's type is <code>boolean</code>). A default setter is named <code>setFoo</code> if the field is called <code>foo</code>, returns <code>void</code>, and takes 1 parameter of the same type as the field. It simply sets the field to this value.
</p><p>
- The generated getter/setter method will be <code>public</code> unless you explicitly specify an <code>AccessLevel</code>, as shown in the example below.
- Legal access levels are <code>PUBLIC</code>, <code>PROTECTED</code>, <code>PACKAGE</code>, and <code>PRIVATE</code>.
+ The generated getter/setter method will be <code>public</code> unless you explicitly specify an <code>AccessLevel</code>, as shown in the example below. Legal access levels are <code>PUBLIC</code>, <code>PROTECTED</code>, <code>PACKAGE</code>, and <code>PRIVATE</code>.
</p><p>
- You can also put a <code>@Getter</code> and/or <code>@Setter</code> annotation on a class. In that case, it's as if you annotate all the non-static fields in that
- class with the annotation.
+ You can also put a <code>@Getter</code> and/or <code>@Setter</code> annotation on a class. In that case, it's as if you annotate all the non-static fields in that class with the annotation.
</p><p>
- You can always manually disable getter/setter generation for any field by using the special <code>AccessLevel.NONE</code> access level. This lets you override the
- behaviour of a <code>@Getter</code>, <code>@Setter</code> or <code>@Data</code> annotation on a class.
+ You can always manually disable getter/setter generation for any field by using the special <code>AccessLevel.NONE</code> access level. This lets you override the behaviour of a <code>@Getter</code>, <code>@Setter</code> or <code>@Data</code> annotation on a class.
</p><p>
To put annotations on the generated method, you can use <code>onMethod=@__({@AnnotationsHere})</code>; to put annotations on the only parameter of a generated setter method, you can use <code>onParam=@__({@AnnotationsHere})</code>. Be careful though! This is an experimental feature. For more details see the documentation on the <a href="experimental/onX.html">onX</a> feature.
</p><p>
@@ -55,6 +50,8 @@
<dd>If set to <code>true</code>, generated getters and setters will not be prefixed with the bean-standard '<code>get</code>, <code>is</code> or <code>set</code>; instead, the methods will use the same name as the field (minus prefixes). An explicitly configured <code>chain</code> parameter of an <a href="experimental/Accessors.html"><code>@Accessors</code></a> annotation takes precedence over this setting.</dd>
<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="experimental/Accessors.html"><code>@Accessors</code></a> annotation takes precedence over this setting.</dd>
+ <dt><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>
<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.</dd>
<dt><code>lombok.getter.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt>
@@ -64,12 +61,9 @@
<div class="overview">
<h3>Small print</h3><div class="smallprint">
<p>
- For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified.
- Then, get/set/is is prefixed.
+ For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified. Then, get/set/is is prefixed.
</p><p>
- No method is generated if any method already exists with the same name (case insensitive) and same parameter count. For example, <code>getFoo()</code>
- will not be generated if there's already a method <code>getFoo(String... x)</code> even though it is technically possible to make the method. This caveat
- exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. Varargs count as 0 to N parameters.
+ No method is generated if any method already exists with the same name (case insensitive) and same parameter count. For example, <code>getFoo()</code> will not be generated if there's already a method <code>getFoo(String... x)</code> even though it is technically possible to make the method. This caveat exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. Varargs count as 0 to N parameters. You can mark any method with <code>@lombok.experimental.Tolerate</code> to hide them from lombok.
</p><p>
For <code>boolean</code> fields that start with <code>is</code> immediately followed by a title-case letter, nothing is prefixed to generate the getter name.
</p><p>