Class SemVer.Builder

  • Enclosing class:
    SemVer

    public static class SemVer.Builder
    extends Object
    An inner static Builder class used for building the SemVer object with various criteria. This uses the builder fluent API pattern. All of the attributes in this Builder class correspond to the attributes in the containing SemVer class.
    • Constructor Detail

      • Builder

        public Builder()
        No-arg constructor for the Builder. Sets all the version values to 0.
      • Builder

        public Builder​(String version)
        A Builder constructor that takes a version string which should have a value in SemVer notation, e.g. 12.0.1, or 11, or 9.2. Attempts to parse the version into the appropriate major, minor, and/or patch values.
        Parameters:
        version - The version value in SemVer notation to parse into the major, minor, and/or patch values.
    • Method Detail

      • withMajor

        public SemVer.Builder withMajor​(int major)
        Sets the given major value for the version in the builder.
        Parameters:
        major - The major value to set.
        Returns:
        This builder instance with the major value set.
      • withMinor

        public SemVer.Builder withMinor​(int minor)
        Sets the given minor value for the version in the builder.
        Parameters:
        minor - The minor value to set.
        Returns:
        This builder instance with the minor value set.
      • withPatch

        public SemVer.Builder withPatch​(int patch)
        Sets the given patch value for the version in the builder.
        Parameters:
        patch - The patch value to set.
        Returns:
        This builder instance with the patch value set.
      • build

        public SemVer build()
        Builds a SemVer object with the given major, minor, and patch values that have been set in the builder.
        Returns:
        A SemVer object containing the major, minor, and patch values from the builder.