Skip to content

Commit

Permalink
Merge 886546f into 31633f0
Browse files Browse the repository at this point in the history
  • Loading branch information
hankem committed Jun 13, 2019
2 parents 31633f0 + 886546f commit 8671a4a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 33 deletions.
30 changes: 19 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
>
Expand Down Expand Up @@ -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 <random@developer.example.org>
Signed-off-by: Random J Developer <random@developer.example.org>

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

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.19.0</version>
<version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.10.0</version>
<version>3.12.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/tngtech/configbuilder/ConfigBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ public class ConfigBuilder<T> {
private Properties additionalProperties;
private String[] commandLineArgs = {};


protected ConfigBuilder(Class<T> configClass, ConfigBuilderFactory configBuilderFactory) {

configBuilderFactory.<T>initialize();
this.configClass = configClass;
this.builderConfiguration = configBuilderFactory.getInstance(BuilderConfiguration.class);
Expand Down Expand Up @@ -104,7 +102,7 @@ public ConfigBuilder<T> 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<T> withImportedConfiguration(Object importedConfiguration) {
Expand All @@ -113,9 +111,9 @@ public ConfigBuilder<T> 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<T> overridePropertiesFiles(List<String> baseNames) {
Expand Down Expand Up @@ -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 <T> generic type of the config class
* @return ConfigBuilder instance for config class
*/
public static <T> ConfigBuilder<T> on(Class<T> clazz) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.lang.annotation.Annotation;

/**
* Processes CommandLineValue annotations, implements ValueExtractorProcessor
* Processes {@link CommandLineValue} annotations
*/
public class CommandLineValueProcessor implements ValueExtractorProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.lang.annotation.Annotation;

/**
* Processes DefaultValue annotations, implements ValueExtractorProcessor
* Processes {@link DefaultValue} annotations
*/
public class DefaultValueProcessor implements ValueExtractorProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Properties;

/**
* Processes PropertyValue annotations, implements ValueExtractorProcessor
* Processes {@link PropertyValue} annotations
*/
public class PropertyValueProcessor implements ValueExtractorProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* This annotation is used to specify system properties.<br>
* <b>Usage:</b> <code>@EnvironmentVariableValue("property.key")</code>
* <b>Usage:</b> <code>@SystemPropertyValue("property.key")</code>
*/
@ValueExtractorAnnotation(SystemPropertyProcessor.class)
@Target(ElementType.FIELD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends Annotation>[] 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;
}
Expand Down

0 comments on commit 8671a4a

Please sign in to comment.