mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-02-20 05:21:22 +01:00
Slight refactoring of dependency/Dependency.java class
* Re-uses constructors to reduce duplicate code * Makes sure the constructor with relocate-argument actually sets `this.relocate` * Use `this.` for accessing class variables
This commit is contained in:
parent
21bf900448
commit
adcf8619ec
@ -2,30 +2,21 @@ package com.craftaro.core.dependency;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Dependency {
|
public class Dependency {
|
||||||
|
|
||||||
private final String repositoryUrl;
|
private final String repositoryUrl;
|
||||||
private final String groupId;
|
private final String groupId;
|
||||||
private final String artifactId;
|
private final String artifactId;
|
||||||
private final String version;
|
private final String version;
|
||||||
private boolean relocate;
|
private boolean relocate;
|
||||||
private Relocation relocation;
|
private final Relocation relocation;
|
||||||
|
|
||||||
public Dependency(String repositoryUrl, String groupId, String artifactId, String version) {
|
public Dependency(String repositoryUrl, String groupId, String artifactId, String version) {
|
||||||
this.repositoryUrl = repositoryUrl;
|
this(repositoryUrl, groupId, artifactId, version, true);
|
||||||
this.groupId = groupId.replaceAll(";", ".");
|
|
||||||
this.artifactId = artifactId;
|
|
||||||
this.version = version;
|
|
||||||
this.relocate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dependency(String repositoryUrl, String groupId, String artifactId, String version, boolean relocate) {
|
public Dependency(String repositoryUrl, String groupId, String artifactId, String version, boolean relocate) {
|
||||||
this.repositoryUrl = repositoryUrl;
|
this(repositoryUrl, groupId, artifactId, version, null);
|
||||||
this.groupId = groupId.replaceAll(";", ".");
|
this.relocate = relocate;
|
||||||
this.artifactId = artifactId;
|
|
||||||
this.version = version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dependency(String repositoryUrl, String groupId, String artifactId, String version, @Nullable Relocation relocation) {
|
public Dependency(String repositoryUrl, String groupId, String artifactId, String version, @Nullable Relocation relocation) {
|
||||||
@ -38,26 +29,26 @@ public class Dependency {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getRepositoryUrl() {
|
public String getRepositoryUrl() {
|
||||||
return repositoryUrl;
|
return this.repositoryUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupId() {
|
public String getGroupId() {
|
||||||
return groupId;
|
return this.groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArtifactId() {
|
public String getArtifactId() {
|
||||||
return artifactId;
|
return this.artifactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return this.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Relocation getRelocation() {
|
public Relocation getRelocation() {
|
||||||
return relocation;
|
return this.relocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean relocate() {
|
public boolean relocate() {
|
||||||
return relocate;
|
return this.relocate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user