diff options
author | Maaartin Grajcar <grajcar@seznam.cz> | 2014-05-22 20:35:36 +0200 |
---|---|---|
committer | Maaartin Grajcar <grajcar@seznam.cz> | 2014-05-31 18:24:22 +0200 |
commit | 329b2be3d9087cc7f02a68267ced5f16254c6362 (patch) | |
tree | ae297501398e1e9bfe26c2162514c53549d06fdd /src/core/lombok | |
parent | 842a4759165c5cd05aae63da3921ee11a3641a4b (diff) | |
download | lombok-329b2be3d9087cc7f02a68267ced5f16254c6362.tar.gz lombok-329b2be3d9087cc7f02a68267ced5f16254c6362.tar.bz2 lombok-329b2be3d9087cc7f02a68267ced5f16254c6362.zip |
Create GETTER_CONSEQUENT_BOOLEAN.
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/ConfigurationKeys.java | 8 | ||||
-rw-r--r-- | src/core/lombok/core/handlers/HandlerUtil.java | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java index 427c5f83..e3308f0a 100644 --- a/src/core/lombok/ConfigurationKeys.java +++ b/src/core/lombok/ConfigurationKeys.java @@ -111,6 +111,14 @@ 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. + * + */ + public static final ConfigurationKey<Boolean> GETTER_CONSEQUENT_BOOLEAN = new ConfigurationKey<Boolean>("lombok.getter.consequentBoolean", "Emit a warning or error if @Getter is used.") {}; + // ----- Setter ----- /** diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java index 0d48b624..03bb341c 100644 --- a/src/core/lombok/core/handlers/HandlerUtil.java +++ b/src/core/lombok/core/handlers/HandlerUtil.java @@ -283,6 +283,7 @@ public class HandlerUtil { fieldName = fieldName.toString(); if (fieldName.length() == 0) return null; + 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"); @@ -351,6 +352,7 @@ public class HandlerUtil { private static List<String> toAllAccessorNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean, String booleanPrefix, String normalPrefix, boolean adhereToFluent) { + if (Boolean.TRUE.equals(ast.readConfiguration(ConfigurationKeys.GETTER_CONSEQUENT_BOOLEAN))) isBoolean = false; if (!isBoolean) { String accessorName = toAccessorName(ast, accessors, fieldName, false, booleanPrefix, normalPrefix, adhereToFluent); return (accessorName == null) ? Collections.<String>emptyList() : Collections.singletonList(accessorName); |