Skip to content

Commit

Permalink
Merge pull request #171 from adamretter/hotfix/multi-license-params
Browse files Browse the repository at this point in the history
Make sure multi-license parameters are correctly set by Maven
  • Loading branch information
mathieucarbou authored Jun 7, 2020
2 parents d70d1db + 2a0a2af commit e8031d7
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import org.apache.maven.plugins.annotations.Parameter;

import java.util.Arrays;

public class Multi {

public static final String DEFAULT_SEPARATOR =
Expand Down Expand Up @@ -65,6 +67,25 @@ public String[] getHeaders() {
return headers;
}

/**
* Set a header.
*
* Used by Maven to configure the {@link #headers}
* field, as the class field name is different
* to the alias name used in the pom.xml
* plugin configuration.
*
* @param header the header to set
*/
public void setHeader(final String header) {
if (headers == null) {
headers = new String[] { header };
} else {
headers = Arrays.copyOf(headers, headers.length + 1);
headers[headers.length - 1] = header;
}
}

public void setHeaders(final String[] headers) {
this.headers = headers;
}
Expand All @@ -73,6 +94,25 @@ public String[] getInlineHeaders() {
return inlineHeaders;
}

/**
* Set an inline header.
*
* Used by Maven to configure the {@link #inlineHeaders}
* field, as the class field name is different
* to the alias name used in the pom.xml
* plugin configuration.
*
* @param inlineHeader the inline header to set
*/
public void setInlineHeader(final String inlineHeader) {
if (inlineHeaders == null) {
inlineHeaders = new String[] { inlineHeader };
} else {
inlineHeaders = Arrays.copyOf(inlineHeaders, inlineHeaders.length + 1);
inlineHeaders[inlineHeaders.length - 1] = inlineHeader;
}
}

public void setInlineHeaders(final String[] inlineHeaders) {
this.inlineHeaders = inlineHeaders;
}
Expand All @@ -81,6 +121,25 @@ public String[] getSeparators() {
return separators;
}

/**
* Set a separator.
*
* Used by Maven to configure the {@link #separators}
* field, as the class field name is different
* to the alias name used in the pom.xml
* plugin configuration.
*
* @param separator the separator to set
*/
public void setSeparator(final String separator) {
if (separators == null) {
separators = new String[] { separator };
} else {
separators = Arrays.copyOf(separators, separators.length + 1);
separators[separators.length - 1] = separator;
}
}

public void setSeparators(final String[] separators) {
this.separators = separators;
}
Expand Down

0 comments on commit e8031d7

Please sign in to comment.