/** * Creates a new package id * @param group group id * @param name name * @param version version */ public PackageId(String group, String name, String version) { this(group, name, Version.create(version)); }
/** * Creates a new package id * @param path path of the package * @param version version of the package * * @deprecated As of 3.1.42, the storage location is implementation details. */ @Deprecated public PackageId(String path, String version) { this(path, Version.create(version)); }
/** * Creates a new version from the given string. * * @param str the version string. * @return the new version or {@link Version#EMPTY} if {@code str} is an empty string. * @since 2.2.4 */ @Nonnull public static Version create(@Nullable String str) { if (str == null || str.length() == 0) { return Version.EMPTY; } return Version.create(Text.explode(str, '.')); }
private Version normalizeVersion(final Version version) { final int numVersionSegments = 3; final String[] normalizedSegments = version.getNormalizedSegments(); final String[] segments = new String[numVersionSegments]; if (normalizedSegments.length <= 0) { segments[0] = "1"; } else { segments[0] = normalizedSegments[0]; } if (normalizedSegments.length <= 1) { segments[1] = "0"; } else { segments[1] = normalizedSegments[1]; } if (normalizedSegments.length <= 2) { segments[2] = "0"; } else { segments[2] = normalizedSegments[2]; } return Version.create(segments); }
this.version = Version.create(str.toString());
public int compareTo(PackId o) { if (o == null) { return -1; } if (this.getGroup().equals(o.getGroup())) { if (this.getName().equals(o.getName())) { if (this.getVersion().equals(o.getVersion())) { return 0; } else { return Version.create(this.getVersion()).compareTo(Version.create(o.getVersion())); } } else { return this.getName().compareTo(o.getName()); } } else { return this.getGroup().compareTo(o.getGroup()); } }
group == null ? id.getGroup() : group, name == null ? id.getName() : name, version == null ? id.getVersion() : Version.create(version) ); String dstPath = getInstallationPath(newId) + ".zip";