From d680f8c7f48b6a982c2cea0e8758716eee4807bc Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 22 Dec 2013 04:40:54 +0100 Subject: [configuration] initial batch of configuration keys, primarily for flag usages. --- src/core/lombok/experimental/Accessors.java | 12 +++++++++++- src/core/lombok/experimental/Builder.java | 10 ++++++++++ src/core/lombok/experimental/ExtensionMethod.java | 12 +++++++++++- src/core/lombok/experimental/FieldDefaults.java | 11 ++++++++++- src/core/lombok/experimental/Wither.java | 9 +++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) (limited to 'src/core/lombok/experimental') diff --git a/src/core/lombok/experimental/Accessors.java b/src/core/lombok/experimental/Accessors.java index 2748bfa9..a74cbb91 100644 --- a/src/core/lombok/experimental/Accessors.java +++ b/src/core/lombok/experimental/Accessors.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * A container for settings for the generation of getters and setters. *

@@ -37,6 +40,13 @@ import java.lang.annotation.Target; @Target({ElementType.TYPE, ElementType.FIELD}) @Retention(RetentionPolicy.SOURCE) public @interface Accessors { + /** + * lombok configuration: {@code lombok.Accessors.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @Accessors} results in a warning / error. + */ + ConfigurationKey FLAG_USAGE = new ConfigurationKey("lombok.Accessors.flagUsage") {}; + /** * If true, accessors will be named after the field and not include a get or set * prefix. If true and chain is omitted, chain defaults to true. diff --git a/src/core/lombok/experimental/Builder.java b/src/core/lombok/experimental/Builder.java index 1300e7d3..56675dd1 100644 --- a/src/core/lombok/experimental/Builder.java +++ b/src/core/lombok/experimental/Builder.java @@ -27,6 +27,9 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.Retention; import java.lang.annotation.Target; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * The builder annotation creates a so-called 'builder' aspect to the class that is annotated or the class * that contains a member which is annotated with {@code @Builder}. @@ -107,6 +110,13 @@ import java.lang.annotation.Target; @Target({TYPE, METHOD, CONSTRUCTOR}) @Retention(SOURCE) public @interface Builder { + /** + * lombok configuration: {@code lombok.Builder.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @Builder} results in a warning / error. + */ + ConfigurationKey FLAG_USAGE = new ConfigurationKey("lombok.Builder.flagUsage") {}; + /** Name of the static method that creates a new builder instance. Default: {@code builder}. */ String builderMethodName() default "builder"; diff --git a/src/core/lombok/experimental/ExtensionMethod.java b/src/core/lombok/experimental/ExtensionMethod.java index 44f28d04..483ede33 100644 --- a/src/core/lombok/experimental/ExtensionMethod.java +++ b/src/core/lombok/experimental/ExtensionMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,9 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or * otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as @@ -60,6 +63,13 @@ import java.lang.annotation.*; @Target(TYPE) @Retention(SOURCE) public @interface ExtensionMethod { + /** + * lombok configuration: {@code lombok.ExtensionMethod.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @ExtensionMethod} results in a warning / error. + */ + ConfigurationKey FLAG_USAGE = new ConfigurationKey("lombok.ExtensionMethod.flagUsage") {}; + /** All types whose static methods will be exposed as extension methods. */ Class[] value(); diff --git a/src/core/lombok/experimental/FieldDefaults.java b/src/core/lombok/experimental/FieldDefaults.java index 8a3fb534..9a17efbc 100644 --- a/src/core/lombok/experimental/FieldDefaults.java +++ b/src/core/lombok/experimental/FieldDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import lombok.AccessLevel; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; /** * Adds modifiers to each field in the type with this annotation. @@ -41,6 +43,13 @@ import lombok.AccessLevel; @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) public @interface FieldDefaults { + /** + * lombok configuration: {@code lombok.FieldDefaults.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @FieldDefaults} results in a warning / error. + */ + ConfigurationKey FLAG_USAGE = new ConfigurationKey("lombok.FieldDefaults.flagUsage") {}; + AccessLevel level() default AccessLevel.NONE; boolean makeFinal() default false; } diff --git a/src/core/lombok/experimental/Wither.java b/src/core/lombok/experimental/Wither.java index f667cb1f..259e0c5e 100644 --- a/src/core/lombok/experimental/Wither.java +++ b/src/core/lombok/experimental/Wither.java @@ -27,6 +27,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import lombok.AccessLevel; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; /** * Put on any field to make lombok build a 'wither' - a withX method which produces a clone of this object (except for 1 field which gets a new value). @@ -54,6 +56,13 @@ import lombok.AccessLevel; @Target({ElementType.FIELD, ElementType.TYPE}) @Retention(RetentionPolicy.SOURCE) public @interface Wither { + /** + * lombok configuration: {@code lombok.Wither.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @Value} results in a warning / error. + */ + ConfigurationKey FLAG_USAGE = new ConfigurationKey("lombok.Wither.flagUsage") {}; + /** * If you want your wither to be non-public, you can specify an alternate access level here. */ -- cgit