Class LicenseClassifier
java.lang.Object
org.codehaus.mojo.license.download.LicenseClassifier
Sorts license names into the categories a reader of a license report cares about: the ones that were signed off,
the ones that need a second look, the ones that must not appear at all, and everything nobody has classified yet.
Names are matched ignoring case and surrounding whitespace. Use licenseMerges to bring the spelling
variants of one license together before they reach this point.
- Since:
- 2.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow a license compares against the configured lists, from the most to the least worrying. -
Constructor Summary
ConstructorsConstructorDescriptionLicenseClassifier(Collection<String> forbiddenLicenses, Collection<String> problematicLicenses, Collection<String> okLicenses) -
Method Summary
Modifier and TypeMethodDescriptionclassify(ProjectLicense license) Classifies a single license.classify(ProjectLicenseInfo info) Classifies a dependency by the most worrying of its licenses, so that a dependency offering both a forbidden and an approved license is not filed away as approved.booleanisEmpty()Whether any license was classified at all.
-
Constructor Details
-
LicenseClassifier
public LicenseClassifier(Collection<String> forbiddenLicenses, Collection<String> problematicLicenses, Collection<String> okLicenses)
-
-
Method Details
-
isEmpty
public boolean isEmpty()Whether any license was classified at all. A classifier without a single configured name leaves every licenseLicenseClassifier.LicenseMatch.unknown, so callers can skip the work entirely.- Returns:
- whether at least one license name is configured
-
classify
Classifies a single license.- Parameters:
license- the license, may benull- Returns:
- the category the license falls into, never
null
-
classify
Classifies a dependency by the most worrying of its licenses, so that a dependency offering both a forbidden and an approved license is not filed away as approved.- Parameters:
info- the dependency- Returns:
- the category the dependency falls into, never
null
-