Polish "Add dependency classifier support"

See gh-1049
This commit is contained in:
Stephane Nicoll
2020-03-17 05:31:23 +01:00
parent a81e4ef77b
commit 835f69986c
14 changed files with 108 additions and 115 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,10 +87,10 @@ public class Dependency extends MetadataElement implements Describable {
private String version;
private String type;
private String classifier;
private String type;
private List<Mapping> mappings = new ArrayList<>();
private String scope = SCOPE_COMPILE;
@@ -132,6 +132,7 @@ public class Dependency extends MetadataElement implements Describable {
this.groupId = dependency.groupId;
this.artifactId = dependency.artifactId;
this.version = dependency.version;
this.classifier = dependency.classifier;
this.type = dependency.type;
this.mappings.addAll(dependency.mappings);
this.scope = dependency.scope;
@@ -145,7 +146,6 @@ public class Dependency extends MetadataElement implements Describable {
this.starter = dependency.starter;
this.keywords.addAll(dependency.keywords);
this.links.addAll(dependency.links);
this.classifier = dependency.classifier;
}
public void setScope(String scope) {
@@ -328,6 +328,11 @@ public class Dependency extends MetadataElement implements Describable {
this.version = version;
}
/**
* Return the classifier, can be {@code null} to indicate that no classifier is
* available.
* @return the classifier or {@code null}
*/
public String getClassifier() {
return this.classifier;
}
@@ -469,18 +474,12 @@ public class Dependency extends MetadataElement implements Describable {
}
public static Dependency withId(String id, String groupId, String artifactId, String version, String scope) {
return withId(id, groupId, artifactId, version, scope, null);
}
public static Dependency withId(String id, String groupId, String artifactId, String version, String scope,
String classifier) {
Dependency dependency = new Dependency();
dependency.setId(id);
dependency.groupId = groupId;
dependency.artifactId = artifactId;
dependency.version = version;
dependency.scope = (scope != null) ? scope : SCOPE_COMPILE;
dependency.classifier = classifier;
return dependency;
}
@@ -527,8 +526,6 @@ public class Dependency extends MetadataElement implements Describable {
*/
private String version;
private String classifier;
/**
* The starter setting to use for the mapping or {@code null} to use the default.
*/
@@ -561,14 +558,6 @@ public class Dependency extends MetadataElement implements Describable {
this.version = version;
}
public String getClassifier() {
return this.classifier;
}
public void setClassifier(String classifier) {
this.classifier = classifier;
}
public Boolean getStarter() {
return this.starter;
}