From bc44b760a3b20721692117d27e820fe3ba921d30 Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 21:30:24 +0200 Subject: [PATCH 1/6] reword contributing guidelines Signed-off-by: Manfred Hanke --- CONTRIBUTING.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09cd2bd9..fee614a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,20 +1,23 @@ # Contributing -Contributions are very welcome. The following will provide some helpful guidelines. +Contributions are very welcome! ## How to contribute We love pull requests. Here is a quick guide: -2. Fork the repo. -3. Create a new branch from master. -5. Add your change together with necessary tests. -6. Run `mvn clean build` and ensure all tests are passing. -7. Commit and push to your fork/branch and submit a pull request. Don't forget to sign-off your commit (see next section). -8. Create a pull request. +1. Fork the repo. +2. Create a new branch from `master`. +3. Add your change together with necessary tests. +4. Run `mvn clean build` and ensure all tests are passing. +5. Commit with a DCO sign-off message (see next section) and push to your fork/branch. +6. Create a pull request. -## Sign your work - the Developer's Certificate of Origin -The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from developercertificate.org): +## Sign your work – the Developer's Certificate of Origin +The sign-off is a simple line at the end of the explanation for the patch, +which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. +The rules are pretty simple: +You need to certify the below (from [developercertificate.org](https://developercertificate.org/)): > Developer's Certificate of Origin 1.1 > @@ -46,11 +49,16 @@ The sign-off is a simple line at the end of the explanation for the patch, which The DCO requires a sign-off message in the following format appear on each commit in the pull request: -> Signed-off-by: Random J Developer + Signed-off-by: Random J Developer using your real name (sorry, no pseudonyms or anonymous contributions.) -The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit --amend -s**. If you've pushed your changes to Github already you'll need to force push your branch after this with **git push -f**. +The DCO text can either be manually added to your commit body, +or you can add either **`-s`** or **`--signoff`** to your usual **`git commit`** commands. +If you forget to add the sign-off you can also amend a previous commit with the sign-off +by running **`git commit --amend -s`**. +If you've pushed your changes to Github already +you'll need to force push your branch after this with **`git push -f`**. #### Alternative Sign-Off Methods in rare cases From 3e40fa752e1684806ff743ee7fa5ba641132297c Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 21:38:02 +0200 Subject: [PATCH 2/6] correct usage documentation of @SystemPropertyValue annotation Signed-off-by: Manfred Hanke --- .../annotation/valueextractor/SystemPropertyValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyValue.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyValue.java index 7a7ba624..edde492a 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyValue.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyValue.java @@ -7,7 +7,7 @@ /** * This annotation is used to specify system properties.
- * Usage: @EnvironmentVariableValue("property.key") + * Usage: @SystemPropertyValue("property.key") */ @ValueExtractorAnnotation(SystemPropertyProcessor.class) @Target(ElementType.FIELD) From b264506d9f613a64730f43f6468130fa5484f91f Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 21:39:53 +0200 Subject: [PATCH 3/6] link each ValueExtractorProcessor's documentation to the corresponding annotation dropping the (obvious) ', implements ValueExtractorProcessor' part Signed-off-by: Manfred Hanke --- .../annotation/valueextractor/CommandLineValueProcessor.java | 2 +- .../annotation/valueextractor/DefaultValueProcessor.java | 2 +- .../annotation/valueextractor/EnvironmentVariableProcessor.java | 2 +- .../annotation/valueextractor/PropertyValueProcessor.java | 2 +- .../annotation/valueextractor/SystemPropertyProcessor.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/CommandLineValueProcessor.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/CommandLineValueProcessor.java index 6e0a4295..c5e03cf0 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/CommandLineValueProcessor.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/CommandLineValueProcessor.java @@ -7,7 +7,7 @@ import java.lang.annotation.Annotation; /** - * Processes CommandLineValue annotations, implements ValueExtractorProcessor + * Processes {@link CommandLineValue} annotations */ public class CommandLineValueProcessor implements ValueExtractorProcessor { diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/DefaultValueProcessor.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/DefaultValueProcessor.java index 3b5471a7..69fd9dc5 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/DefaultValueProcessor.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/DefaultValueProcessor.java @@ -5,7 +5,7 @@ import java.lang.annotation.Annotation; /** - * Processes DefaultValue annotations, implements ValueExtractorProcessor + * Processes {@link DefaultValue} annotations */ public class DefaultValueProcessor implements ValueExtractorProcessor { diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/EnvironmentVariableProcessor.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/EnvironmentVariableProcessor.java index e739128b..ebc2931d 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/EnvironmentVariableProcessor.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/EnvironmentVariableProcessor.java @@ -5,7 +5,7 @@ import java.lang.annotation.Annotation; /** - * Processes EnvironmentVariableValue annotations, implements ValueExtractorProcessor + * Processes {@link EnvironmentVariableValue} annotations */ public class EnvironmentVariableProcessor implements ValueExtractorProcessor { public String getValue(Annotation annotation, ConfigBuilderFactory configBuilderFactory) { diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/PropertyValueProcessor.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/PropertyValueProcessor.java index 4dcf0d39..ce17ff86 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/PropertyValueProcessor.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/PropertyValueProcessor.java @@ -7,7 +7,7 @@ import java.util.Properties; /** - * Processes PropertyValue annotations, implements ValueExtractorProcessor + * Processes {@link PropertyValue} annotations */ public class PropertyValueProcessor implements ValueExtractorProcessor { diff --git a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyProcessor.java b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyProcessor.java index 55aae77d..4f16ff7b 100644 --- a/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyProcessor.java +++ b/src/main/java/com/tngtech/configbuilder/annotation/valueextractor/SystemPropertyProcessor.java @@ -5,7 +5,7 @@ import java.lang.annotation.Annotation; /** - * Processes SystemPropertyValue annotations, implements ValueExtractorProcessor + * Processes {@link SystemPropertyValue} annotations */ public class SystemPropertyProcessor implements ValueExtractorProcessor { public String getValue(Annotation annotation, ConfigBuilderFactory configBuilderFactory) { From a2d7473421b532d79123ad3008e332c31a835432 Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 22:12:19 +0200 Subject: [PATCH 4/6] eliminate JavaDoc warnings on missing parameter descriptions Signed-off-by: Manfred Hanke --- .../java/com/tngtech/configbuilder/ConfigBuilder.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/tngtech/configbuilder/ConfigBuilder.java b/src/main/java/com/tngtech/configbuilder/ConfigBuilder.java index 3aac859f..fe79902b 100644 --- a/src/main/java/com/tngtech/configbuilder/ConfigBuilder.java +++ b/src/main/java/com/tngtech/configbuilder/ConfigBuilder.java @@ -66,9 +66,7 @@ public class ConfigBuilder { private Properties additionalProperties; private String[] commandLineArgs = {}; - protected ConfigBuilder(Class configClass, ConfigBuilderFactory configBuilderFactory) { - configBuilderFactory.initialize(); this.configClass = configClass; this.builderConfiguration = configBuilderFactory.getInstance(BuilderConfiguration.class); @@ -104,7 +102,7 @@ public ConfigBuilder withCommandLineArgs(String[] args) { /** * Imports the values from the given object according to the field names in the annotations - * @param importedConfiguration + * @param importedConfiguration configuration object to be imported * @return the instance of ConfigBuilder */ public ConfigBuilder withImportedConfiguration(Object importedConfiguration) { @@ -113,9 +111,9 @@ public ConfigBuilder withImportedConfiguration(Object importedConfiguration) } /** - * Configures the Config Builder to load given properties files instead of those specified in the config class. + * Configures the Config Builder to load given property files instead of those specified in the config class. * - * @param baseNames + * @param baseNames base names of the property files to be loaded * @return the instance of ConfigBuilder */ public ConfigBuilder overridePropertiesFiles(List baseNames) { @@ -291,6 +289,7 @@ private void initializeErrorMessageSetup(PropertyLoader propertyLoader) { * Gets an instance of the ConfigBuilder for a given config class * * @param clazz config class for which the config builder is instantiated. + * @param generic type of the config class * @return ConfigBuilder instance for config class */ public static ConfigBuilder on(Class clazz) { From d438719e348782b8c5cf0a72d934cc07126d6085 Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 22:12:35 +0200 Subject: [PATCH 5/6] simplify BuilderConfiguration initialization Signed-off-by: Manfred Hanke --- .../configuration/BuilderConfiguration.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/tngtech/configbuilder/configuration/BuilderConfiguration.java b/src/main/java/com/tngtech/configbuilder/configuration/BuilderConfiguration.java index bb33a34b..07f182a2 100644 --- a/src/main/java/com/tngtech/configbuilder/configuration/BuilderConfiguration.java +++ b/src/main/java/com/tngtech/configbuilder/configuration/BuilderConfiguration.java @@ -11,18 +11,12 @@ */ public class BuilderConfiguration { - private Properties properties; - private CommandLine commandLine; - private Object importedConfiguration; + private Properties properties = new Properties(); + private CommandLine commandLine = null; + private Object importedConfiguration = null; private Class[] annotationOrder = new Class[]{CommandLineValue.class, PropertyValue.class, EnvironmentVariableValue.class, SystemPropertyValue.class, ImportedValue.class, DefaultValue.class}; private String[] propertyNamePrefixes = new String[]{""}; - public BuilderConfiguration() { - properties = new Properties(); - commandLine = null; - importedConfiguration = null; - } - public CommandLine getCommandLine() { return commandLine; } From 886546f642b91a46e8d4ca1659e7ff902b9a7e90 Mon Sep 17 00:00:00 2001 From: Manfred Hanke Date: Thu, 13 Jun 2019 22:34:02 +0200 Subject: [PATCH 6/6] update test dependencies (mockito, assertj) Signed-off-by: Manfred Hanke --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 978d3421..a44417da 100644 --- a/pom.xml +++ b/pom.xml @@ -183,13 +183,13 @@ org.mockito mockito-core - 2.19.0 + 2.28.2 test org.assertj assertj-core - 3.10.0 + 3.12.2 test