code: public static Version parseVersion(String versionString,
              boolean allowPreRelease) {
          final Version version = parseVersion(versionString);
          if (!allowPreRelease && (version.isPreRelease() || version.hasBuildMetaData())) {
              throw new VersionFormatException(String.format(
                      "Version string '%s' is expected to have no pre-release or "
                              + "build meta data part",
                      versionString));
          }
          return version;
      }
docs: Tries to parse the provided String as a semantic version. If
  {@code allowPreRelease} is <code>false</code>, the String must have neither a
  pre-release nor a build meta data part. Thus the given String must have the format
  {@code X.Y.Z} where at least one part must be greater than zero.
  
  <p>
  If {@code allowPreRelease} is <code>true</code>, the String is parsed according to
  the normal semantic version specification.
  
  
  @param versionString The String to parse.
  @param allowPreRelease Whether pre-release and build meta data field are allowed.
  @return The parsed version.
  @throws VersionFormatException If the String is no valid version
  @since 0.4.0