mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 22:17:41 +00:00
Create GETTER_CONSEQUENT_BOOLEAN.
This commit is contained in:
1 parent
842a475916
commit
329b2be3d9
2 files changed
+10
No files matched your search
@@ -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 -----
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user