Package ca.solostudios.strata.version
Class PreReleaseIdentifier
- java.lang.Object
-
- ca.solostudios.strata.version.PreReleaseIdentifier
-
- All Implemented Interfaces:
Formattable
,java.lang.Comparable<PreReleaseIdentifier>
- Direct Known Subclasses:
PreReleaseIdentifier.AlphaNumericalPreReleaseIdentifier
,PreReleaseIdentifier.NumericalPreReleaseIdentifier
public abstract class PreReleaseIdentifier extends java.lang.Object implements java.lang.Comparable<PreReleaseIdentifier>, Formattable
This class represents a pre-release identifier. There are only two implementations:PreReleaseIdentifier.NumericalPreReleaseIdentifier
andPreReleaseIdentifier.AlphaNumericalPreReleaseIdentifier
.Note: this class has a natural ordering that is inconsistent with equals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PreReleaseIdentifier.AlphaNumericalPreReleaseIdentifier
An alphanumerical identifier.static class
PreReleaseIdentifier.NumericalPreReleaseIdentifier
A numerical identifier.
-
Constructor Summary
Constructors Constructor Description PreReleaseIdentifier()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.math.BigInteger
asInteger()
This identifier as an integer.protected abstract @NotNull java.lang.String
asString()
This identifier formatted as a string.int
compareTo(@NotNull PreReleaseIdentifier o)
@NotNull java.lang.String
getFormatted()
This object represented as a short and human readable string.protected abstract boolean
isNumeric()
Whether or not this identifier can contain numerical values.
-
-
-
Method Detail
-
compareTo
public int compareTo(@NotNull @NotNull PreReleaseIdentifier o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PreReleaseIdentifier>
-
asInteger
protected java.math.BigInteger asInteger() throws java.lang.UnsupportedOperationException
This identifier as an integer.- Returns:
- This identifier as an integer.
- Throws:
java.lang.UnsupportedOperationException
- If this identifier cannot be formatted as an integer.
-
asString
@NotNull protected abstract @NotNull java.lang.String asString()
This identifier formatted as a string.- Returns:
- This identifier as a string.
-
getFormatted
@NotNull public @NotNull java.lang.String getFormatted()
Description copied from interface:Formattable
This object represented as a short and human readable string.- Specified by:
getFormatted
in interfaceFormattable
- Returns:
- This object as a readable string.
-
isNumeric
protected abstract boolean isNumeric()
Whether or not this identifier can contain numerical values.- Returns:
true
if this identifier can contain numerical values,false
otherwise.
-
-