diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/Dependency.java b/cli/src/main/java/com/devonfw/tools/ide/tool/Dependency.java index 57f4613b1..be5661abf 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/Dependency.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/Dependency.java @@ -66,12 +66,12 @@ public List readJson(VersionIdentifier version, String toolEditi */ public VersionIdentifier findDependencyVersionToInstall(DependencyInfo dependencyFound) { - String dependencyEdition = this.context.getVariables().getToolEdition(dependencyFound.getTool()); - - List versions = this.context.getUrls().getSortedVersions(dependencyFound.getTool(), dependencyEdition); - + String dependencyTool = dependencyFound.tool(); + String dependencyEdition = this.context.getVariables().getToolEdition(dependencyTool); + List versions = this.context.getUrls().getSortedVersions(dependencyTool, dependencyEdition); + VersionRange dependencyVersionRange = dependencyFound.versionRange(); for (VersionIdentifier vi : versions) { - if (dependencyFound.getVersionRange().contains(vi)) { + if (dependencyVersionRange.contains(vi)) { return vi; } } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java index 1ecf72b2e..788729f5f 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java @@ -389,7 +389,7 @@ private DependencyInfo readDependencies(VersionIdentifier toolVersion) { private void installDependencies(DependencyInfo dependencyInfo, EnvironmentContext ec) { - String dependencyName = dependencyInfo.getTool(); + String dependencyName = dependencyInfo.tool(); LocalToolCommandlet dependencyTool = (LocalToolCommandlet) this.context.getCommandletManager().getToolCommandlet(dependencyName); VersionIdentifier dependencyVersionToInstall = this.dependency.findDependencyVersionToInstall(dependencyInfo); @@ -399,7 +399,7 @@ private void installDependencies(DependencyInfo dependencyInfo, EnvironmentConte installDependencyInRepo(dependencyName, dependencyTool, dependencyVersionToInstall, ec); dependencyTool.setEnvironment(ec, dependencyRepository.resolve(dependencyVersionToInstall.toString())); } else { - Path versionExistingInRepository = this.dependency.versionExistsInRepository(dependencyRepository, dependencyInfo.getVersionRange()); + Path versionExistingInRepository = this.dependency.versionExistsInRepository(dependencyRepository, dependencyInfo.versionRange()); boolean versionExistingInRepositoryIsEmpty = versionExistingInRepository.equals(Path.of("")); if (versionExistingInRepositoryIsEmpty) { diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/DependencyInfo.java b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/DependencyInfo.java index 98d626627..a192d2b8f 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/DependencyInfo.java +++ b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/DependencyInfo.java @@ -3,37 +3,8 @@ import com.devonfw.tools.ide.version.VersionRange; /** - * Model to represent the Object of the dependencies inside the Json file. + * Model to represent a dependency of a tool (inside a "dependencies.json" file). */ -public final class DependencyInfo { +public record DependencyInfo(String tool, VersionRange versionRange) { - private String tool; - - private VersionRange versionRange; - - /** - * @return the dependency name - */ - public String getTool() { - - return this.tool; - } - - void setTool(String tool) { - - this.tool = tool; - } - - /** - * @return the VersionRange of the dependency - */ - public VersionRange getVersionRange() { - - return this.versionRange; - } - - void setVersionRange(VersionRange versionRange) { - - this.versionRange = versionRange; - } }