java.lang.Object
net.luis.utils.util.Version.Builder
- Enclosing class:
Version
This class represents a builder for a version number.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Version.AppendingVersion
The appendable build version number.private int
The major version number.private int
The minor version number.private int
The patch or fix version number.private String
The suffix or pre-release identifier.private Version.AppendingVersion
The appendable suffix version number. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Builder
(int major, int minor) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.private
Builder
(int major, int minor, int patch) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0. -
Method Summary
Modifier and TypeMethodDescription@NotNull Version
build()
Builds the version with the given version numbers.boolean
int
hashCode()
@NotNull Version.Builder
withBuild
(char separator, int version) Sets the build version number and the separator.
The build version number will be clamped to a minimum of 0.@NotNull Version.Builder
withMajor
(int major) Sets the major version number.
The major version number will be clamped to a minimum of 0.@NotNull Version.Builder
withMinor
(int minor) Sets the minor version number.
The minor version number will be clamped to a minimum of 0.@NotNull Version.Builder
withPatch
(int patch) Sets the patch or fix version number.
The patch or fix version number will be clamped to a minimum of 0.@NotNull Version.Builder
withSuffix
(@Nullable String suffix) Sets the suffix or pre-release identifier.
Removes leading and trailing whitespace from the suffix.
Recommended suffixes are 'alpha', 'beta', 'rc', 'release-candidate', 'release', and 'final'.@NotNull Version.Builder
withSuffixVersion
(int version) Sets the suffix version number.
The suffix version number will be clamped to a minimum of 0.
-
Field Details
-
major
private int majorThe major version number. -
minor
private int minorThe minor version number. -
patch
private int patchThe patch or fix version number. -
build
The appendable build version number. -
suffix
The suffix or pre-release identifier. -
suffixVersion
The appendable suffix version number.
-
-
Constructor Details
-
Builder
private Builder(int major, int minor) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.- Parameters:
major
- The major version numberminor
- The minor version number
-
Builder
private Builder(int major, int minor, int patch) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.- Parameters:
major
- The major version numberminor
- The minor version numberpatch
- The patch or fix version number
-
-
Method Details
-
withMajor
Sets the major version number.
The major version number will be clamped to a minimum of 0.- Parameters:
major
- The major version number- Returns:
- This builder
-
withMinor
Sets the minor version number.
The minor version number will be clamped to a minimum of 0.- Parameters:
minor
- The minor version number- Returns:
- This builder
-
withPatch
Sets the patch or fix version number.
The patch or fix version number will be clamped to a minimum of 0.- Parameters:
patch
- The patch or fix version number- Returns:
- This builder
-
withBuild
Sets the build version number and the separator.
The build version number will be clamped to a minimum of 0.- Parameters:
separator
- The separator character (must be '.', '-', or 'r')version
- The build version number- Returns:
- This builder
- Throws:
IllegalArgumentException
- If the separator is not '.', '-', or 'r'
-
withSuffix
Sets the suffix or pre-release identifier.
Removes leading and trailing whitespace from the suffix.
Recommended suffixes are 'alpha', 'beta', 'rc', 'release-candidate', 'release', and 'final'.- Parameters:
suffix
- The suffix or pre-release identifier- Returns:
- This builder
-
withSuffixVersion
Sets the suffix version number.
The suffix version number will be clamped to a minimum of 0.- Parameters:
version
- The suffix version number- Returns:
- This builder
-
build
Builds the version with the given version numbers.- Returns:
- The created version
-
equals
-
hashCode
public int hashCode()
-