Package top.focess.util.version
Class Version
- java.lang.Object
-
- top.focess.util.version.Version
-
- All Implemented Interfaces:
Serializable,Comparable<Version>,FocessSerializable
public class Version extends Object implements FocessSerializable, Comparable<Version>
Represents a version of a plugin.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static VersionALPHA_VERSIONRepresents an alpha version of a plugin.static VersionBETA_VERSIONRepresents a beta version of a plugin.static VersionBUILD_VERSIONRepresents a build version of a plugin.static VersionDEFAULT_VERSIONRepresents a default release version of a plugin.
-
Constructor Summary
Constructors Constructor Description Version(int major, int minor)Constructs a new version with the specified version numbers.Version(int major, int minor, int revision)Constructs a new version with the specified version numbers.Version(int major, int minor, int revision, String build)Constructs a new version with the specified version numbers and build.Version(String version)Constructs a new version with the specified version.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version version)static Versiondeserialize(Map<String,Object> map)booleanequals(Object o)StringgetBuild()intgetMajor()intgetMinor()intgetRevision()inthashCode()booleanhigher(@NonNull Version version)Indicate whether this version is greater than the specified versionbooleanlower(@NonNull Version version)Indicate whether this version is lower than the specified versionMap<String,Object>serialize()Serialize the objectStringtoString()
-
-
-
Field Detail
-
ALPHA_VERSION
public static final Version ALPHA_VERSION
Represents an alpha version of a plugin.
-
BETA_VERSION
public static final Version BETA_VERSION
Represents a beta version of a plugin.
-
BUILD_VERSION
public static final Version BUILD_VERSION
Represents a build version of a plugin.
-
DEFAULT_VERSION
public static final Version DEFAULT_VERSION
Represents a default release version of a plugin.
-
-
Constructor Detail
-
Version
public Version(int major, int minor, int revision, String build)Constructs a new version with the specified version numbers and build.- Parameters:
major- the major version numberminor- the minor version numberrevision- the revision version numberbuild- the build version
-
Version
public Version(int major, int minor, int revision)Constructs a new version with the specified version numbers.- Parameters:
major- the major version numberminor- the minor version numberrevision- the revision version number
-
Version
public Version(int major, int minor)Constructs a new version with the specified version numbers.- Parameters:
major- the major version numberminor- the minor version number
-
Version
public Version(@NotNull String version)Constructs a new version with the specified version.- Parameters:
version- the version to be parsed.
-
-
Method Detail
-
getMajor
public int getMajor()
-
getMinor
public int getMinor()
-
getRevision
public int getRevision()
-
getBuild
public String getBuild()
-
higher
public boolean higher(@NonNull Version version)
Indicate whether this version is greater than the specified versionNote: This method is equivalent to
this.compareTo(version) > 0. this method return true also indicatelower(Version)andequals(Object)return false.- Parameters:
version- the version to compare to- Returns:
- true if this version is greater than the specified version, false otherwise
- See Also:
lower(Version),equals(Object),compareTo(Version)
-
lower
public boolean lower(@NonNull Version version)
Indicate whether this version is lower than the specified versionNote: This method is equivalent to
version.higher(this). this method return true also indicatehigher(Version)(Version)} andequals(Object)return false.- Parameters:
version- the version to compare to- Returns:
- true if this version is lower than the specified version, false otherwise
- See Also:
higher(Version),equals(Object),compareTo(Version)
-
serialize
@Nullable public Map<String,Object> serialize()
Description copied from interface:FocessSerializableSerialize the object- Specified by:
serializein interfaceFocessSerializable- Returns:
- the serialized object, null if it should serialize all fields in the object.
-
compareTo
public int compareTo(@NotNull Version version)- Specified by:
compareToin interfaceComparable<Version>
-
-