Class StringToList
java.lang.Object
org.codehaus.mojo.license.utils.StringToList
- Direct Known Subclasses:
AbstractAddThirdPartyMojo.ExcludedLicenses, AbstractAddThirdPartyMojo.IncludedLicenses
Object to convert in mojo a parameter from a some simple String to a List.
See (http://jira.codehaus.org/browse/MLICENSE-53).
- Since:
- 1.4
- Author:
- tchemit dev@tchemit.fr
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRegular expression to split license list with a pipe character: "|". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEntryToList(String data) Adds one license name, dropping the whitespace around it and ignoring it when there is nothing else left.getData()static String[]trimmedStringSplit(String stringToSplit) Splits a String by the pipe character and trims it.
It allows, for example, to write lengthy license merge lists not written as a 400 characters long, hard to read line, but as a list of lines separated by a pipe character.
Example, instead of writing the following XML:
-
Field Details
-
LIST_OF_LICENSES_REG_EX
Regular expression to split license list with a pipe character: "|".- See Also:
-
-
Constructor Details
-
StringToList
public StringToList() -
StringToList
- Parameters:
data- a list of licenses or a URL- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-
Method Details
-
trimmedStringSplit
Splits a String by the pipe character and trims it.
It allows, for example, to write lengthy license merge lists not written as a 400 characters long, hard to read line, but as a list of lines separated by a pipe character.
Example, instead of writing the following XML:
write:Righteous license 2.1|The righteous extra long named super rights granting license version 2.1|Hidden right license 2.1|The completely unfair "all your rights belong to us" license version 2.1 Righteous license 2.1 |The righteous extra long named super rights granting license version 2.1 |Hidden right license 2.1 |The completely unfair "all your rights belong to us" license version 2.1 - Parameters:
stringToSplit- String to split.- Returns:
- Split and trimmed string.
-
getData
-
addEntryToList
Adds one license name, dropping the whitespace around it and ignoring it when there is nothing else left.The names arrive straight out of the POM, so they carry whatever the XML formatter left behind. A list whose entries are long enough gets broken over several lines, either by hand or by a formatter:
<includedLicenses> Apache License 2.0 |MIT License </includedLicenses>
- Parameters:
data- the license name
-