public abstract class VersionChecker
extends java.lang.Object
| Constructor and Description |
|---|
VersionChecker() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.util.List<java.lang.String> |
allVersions() |
abstract java.util.Optional<Update> |
check(@NotNull java.lang.String currentVersion,
boolean checkForPreReleases) |
java.lang.String |
checkForUpdate(@NotNull java.lang.String currentVersion,
boolean checkForPreReleases)
Check whether an update/newer version is available for the given version.
|
protected boolean |
compareSemantics(@NotNull java.lang.String currentVersion,
@NotNull java.lang.String newVersion,
@NotNull Comparison comparison)
Compare the given new version against the given current version, depending on comparison type
EQUAL,
NEW, or EQUAL_OR_NEW. |
protected java.util.List<java.lang.String> |
getAllVersions() |
abstract java.util.List<java.lang.String> |
getAssetsDownloadUrls(@NotNull java.lang.String version)
Deprecated.
|
protected abstract java.lang.String |
getDownloadUrl(@NotNull java.lang.String version) |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected java.lang.String |
getResponse(@NotNull java.net.URL requestUrl)
Acquire the response from a given URL.
|
protected java.lang.String |
isUpdateAvailable(@NotNull java.lang.String currentVersion,
boolean checkForPreReleases)
Check for new versions in beta, alpha and regular release channels.
|
protected java.lang.String |
latestAlpha()
Get the latest alpha release.
|
protected java.lang.String |
latestBeta()
Get the latest beta release.
|
protected abstract java.lang.String |
latestVersion(boolean checkForPreRelease) |
abstract VersionChecker |
refresh() |
protected void |
setAllVersions() |
protected abstract void |
setRepository() |
public java.lang.String checkForUpdate(@NotNull
@NotNull java.lang.String currentVersion,
boolean checkForPreReleases)
true for checkForPreReleases.currentVersion - String. The current version of the app.checkForPreReleases - Boolean. false if you do not want to check for PreReleases. true
if you want to check for PreReleases as well.No updates available.Current version: 2.0.0. A new release is available: 2.1.1. Download available at: https://github.com/Griefed/ServerPackCreator/releases/tag/2.1.1
New prerelease available: Current version: 2.0.0. A new PreRelease is available: 3.0.0-alpha.14. Download available at: https://github.com/Griefed/ServerPackCreator/releases/tag/3.0.0-alpha.14protected java.lang.String isUpdateAvailable(@NotNull
@NotNull java.lang.String currentVersion,
boolean checkForPreReleases)
checkForPreRelease is false,
only regular releases are checked.currentVersion - String. The current version of the app.checkForPreReleases - Boolean. false if you do not want to check for PreReleases. true
if you want to check for PreReleases as well.up_to_date is returned.protected boolean compareSemantics(@NotNull
@NotNull java.lang.String currentVersion,
@NotNull
@NotNull java.lang.String newVersion,
@NotNull
@NotNull Comparison comparison)
EQUAL,
NEW, or EQUAL_OR_NEW.
Checks are performed with the semantic release-formatting, e.g. 1.2.3, 2.3.4, 6.6.6currentVersion - String. Current version to check against newVersion.newVersion - String. New version to check against currentVersion.comparison - Comparison Comparison level. Either EQUAL, NEW, or EQUAL_OR_NEW.true if the new version is indeed newer than the current version. Otherwise
false.java.lang.NumberFormatException - Thrown if the passed currentVersion or newVersion can not be
parsed into integers.protected java.lang.String latestBeta()
throws java.lang.NumberFormatException
no_betas is returned.java.lang.NumberFormatException - Thrown if a version can not be parsed into integers.protected java.lang.String latestAlpha()
throws java.lang.NumberFormatException
no_alphas is returned.java.lang.NumberFormatException - Thrown if a versions can not be parsed into integers.protected java.lang.String getResponse(@NotNull
@NotNull java.net.URL requestUrl)
throws java.io.IOException
requestUrl - String. The URL to get the response from.java.io.IOException - Thrown if the requested URL can not be reached or if any other error occurs during the request.protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
protected abstract java.util.List<java.lang.String> allVersions()
public abstract VersionChecker refresh() throws java.io.IOException
java.io.IOExceptionprotected void setAllVersions()
protected java.util.List<java.lang.String> getAllVersions()
protected abstract java.lang.String latestVersion(boolean checkForPreRelease)
protected abstract java.lang.String getDownloadUrl(@NotNull
@NotNull java.lang.String version)
protected abstract void setRepository()
throws java.io.IOException
java.io.IOException@Deprecated
public abstract java.util.List<java.lang.String> getAssetsDownloadUrls(@NotNull
@NotNull java.lang.String version)
public abstract java.util.Optional<Update> check(@NotNull @NotNull java.lang.String currentVersion, boolean checkForPreReleases)