Package com.github.zafarkhaja.semver
Class Version.Builder
- java.lang.Object
-
- com.github.zafarkhaja.semver.Version.Builder
-
- Enclosing class:
- Version
public static class Version.Builder extends java.lang.ObjectA mutable builder for the immutableVersionclass.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbuildThe build metadata string.private java.lang.StringnormalThe normal version string.private java.lang.StringpreReleaseThe pre-release version string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Versionbuild()Builds aVersionobject.private booleanisFilled(java.lang.String str)Checks if a string has a usable value.Version.BuildersetBuildMetadata(java.lang.String build)Sets the build metadata.Version.BuildersetNormalVersion(java.lang.String normal)Sets the normal version.Version.BuildersetPreReleaseVersion(java.lang.String preRelease)Sets the pre-release version.
-
-
-
Method Detail
-
setNormalVersion
public Version.Builder setNormalVersion(java.lang.String normal)
Sets the normal version.- Parameters:
normal- the string representation of the normal version- Returns:
- this builder instance
-
setPreReleaseVersion
public Version.Builder setPreReleaseVersion(java.lang.String preRelease)
Sets the pre-release version.- Parameters:
preRelease- the string representation of the pre-release version- Returns:
- this builder instance
-
setBuildMetadata
public Version.Builder setBuildMetadata(java.lang.String build)
Sets the build metadata.- Parameters:
build- the string representation of the build metadata- Returns:
- this builder instance
-
build
public Version build()
Builds aVersionobject.- Returns:
- a newly built
Versioninstance - Throws:
ParseException- when invalid version string is providedUnexpectedCharacterException- is a special case ofParseException
-
isFilled
private boolean isFilled(java.lang.String str)
Checks if a string has a usable value.- Parameters:
str- the string to check- Returns:
trueif the string is filled orfalseotherwise
-
-