Class SemanticVersion.PreReleaseIdentifier
- All Implemented Interfaces:
Comparable<SemanticVersion.PreReleaseIdentifier>
- Enclosing class:
SemanticVersion
Identifiers are parsed as numeric identifiers first and, if not numeric, validated as non-numeric identifiers using the regular expression provided by the Semantic Versioning (SemVer) specification.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(@NonNull SemanticVersion.PreReleaseIdentifier other) booleaninthashCode()booleanWhether the identifier was parsed as a numeric value.@Nullable IntegerGet the numeric value, if there is one.static @NonNull SemanticVersion.PreReleaseIdentifierParse the given value as aSemanticVersion.PreReleaseIdentifier.static @NonNull SemanticVersion.PreReleaseIdentifierpreRelease(@NonNull String value) A static sugar forparse(String).@NonNull StringrawValue()Get the raw string value for the identifier.toString()
-
Method Details
-
preRelease
A static sugar forparse(String).- Parameters:
value- The value to parse.- Returns:
- The parsed
SemanticVersion.PreReleaseIdentifier. - See Also:
-
parse
Parse the given value as aSemanticVersion.PreReleaseIdentifier.If the value is empty, it will be rejected upon construction as this is forbidden by the Semantic Versioning (SemVer) specification.
If the value is numeric, it is parsed as a numeric identifier. If the identifier starts with a leading zero, but would otherwise be numeric, a
VersioningExceptionis thrown.If the value is not numeric, it is parsed as a non-numeric identifier and is then validated against the prescribed regular expression (from the specification) upon construction. If it is not valid, per the regular expression, a
VersioningExceptionis thrown.- Parameters:
value- The value to parse.- Returns:
- The parsed
SemanticVersion.PreReleaseIdentifier. - Throws:
VersioningException- If the identifier is not valid.
-
rawValue
Get the raw string value for the identifier.- Returns:
- The raw string value.
-
numericValue
Get the numeric value, if there is one.- Returns:
- The numeric value, or null if one is not set.
-
isNumeric
public boolean isNumeric()Whether the identifier was parsed as a numeric value.This is true when the
numericValue()is not null.- Returns:
- True if, and only if, the identifier has a numeric value.
-
toString
-
equals
-
hashCode
-
compareTo
- Specified by:
compareToin interfaceComparable<SemanticVersion.PreReleaseIdentifier>
-