/** * Creates a new Version instance for the specified service and defines * the major and minor versions for the service. * @param serviceClass the service type. * @param major the major revision number of the service. * @param minor the minor revision number of the service. * @throws NullPointerException if the service type is {@code null}. * @throws IllegalArgumentException if revision values are invalid. */ public Version(Class<? extends Service> serviceClass, int major, int minor, Version ... impliedVersions) throws NullPointerException, IllegalArgumentException { if (serviceClass == null) { throw new NullPointerException("Null service class"); } if (major < 0 && major != ANY) { throw new IllegalArgumentException("Invalid major version:" + major); } if (minor < 0 && minor != ANY) { throw new IllegalArgumentException("Invalid minor version:" + minor); } this.serviceClass = serviceClass; this.major = major; this.minor = minor; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }
/** * Creates a new Version instance for the specified service and defines * the major and minor versions for the service. * @param serviceClass the service type. * @param major the major revision number of the service. * @param minor the minor revision number of the service. * @throws NullPointerException if the service type is {@code null}. * @throws IllegalArgumentException if revision values are invalid. */ public Version(Class<? extends Service> serviceClass, int major, int minor, Version ... impliedVersions) throws NullPointerException, IllegalArgumentException { if (serviceClass == null) { throw new NullPointerException("Null service class"); } if (major < 0 && major != ANY) { throw new IllegalArgumentException("Invalid major version:" + major); } if (minor < 0 && minor != ANY) { throw new IllegalArgumentException("Invalid minor version:" + minor); } this.serviceClass = serviceClass; this.major = major; this.minor = minor; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }
/** * Creates a new Version instance for the specified service and defines * the major and minor versions for the service. * @param serviceClass the service type. * @param major the major revision number of the service. * @param minor the minor revision number of the service. * @throws NullPointerException if the service type is {@code null}. * @throws IllegalArgumentException if revision values are invalid. */ public Version(Class<? extends Service> serviceClass, int major, int minor, Version ... impliedVersions) throws NullPointerException, IllegalArgumentException { if (serviceClass == null) { throw new NullPointerException("Null service class"); } if (major < 0 && major != ANY) { throw new IllegalArgumentException("Invalid major version:" + major); } if (minor < 0 && minor != ANY) { throw new IllegalArgumentException("Invalid minor version:" + minor); } this.serviceClass = serviceClass; this.major = major; this.minor = minor; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }
/** * Creates a new Version instance using a version description with the * format <code>[{service}]{major}.{minor}</code>. * * @param serviceClass the service type. * @param versionDescription the service description. * @throws IllegalArgumentException if the versionDescription has an invalid * syntax or includes a service name that does not match the service * type. */ public Version(Class<? extends Service> serviceClass, String versionDescription, Version ... impliedVersions) throws IllegalArgumentException { this.serviceClass = serviceClass; Matcher matcher = VERSION_PROPERTY_PATTERN.matcher(versionDescription); if (!matcher.matches()) { throw new IllegalArgumentException( "Version description does not match expected format" + "[{service}]{major}[.{minor}]:" + versionDescription); } String minorValue = matcher.group(3); major = Integer.parseInt(matcher.group(2)); minor = (minorValue != null) ? Integer.parseInt(minorValue.substring(1)) : ANY; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }
/** * Creates a new Version instance using a version description with the * format <code>[{service}]{major}.{minor}</code>. * * @param serviceClass the service type. * @param versionDescription the service description. * @throws IllegalArgumentException if the versionDescription has an invalid * syntax or includes a service name that does not match the service * type. */ public Version(Class<? extends Service> serviceClass, String versionDescription, Version ... impliedVersions) throws IllegalArgumentException { this.serviceClass = serviceClass; Matcher matcher = VERSION_PROPERTY_PATTERN.matcher(versionDescription); if (!matcher.matches()) { throw new IllegalArgumentException( "Version description does not match expected format" + "[{service}]{major}[.{minor}]:" + versionDescription); } String minorValue = matcher.group(3); major = Integer.parseInt(matcher.group(2)); minor = (minorValue != null) ? Integer.parseInt(minorValue.substring(1)) : ANY; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }
/** * Creates a new Version instance using a version description with the * format <code>[{service}]{major}.{minor}</code>. * * @param serviceClass the service type. * @param versionDescription the service description. * @throws IllegalArgumentException if the versionDescription has an invalid * syntax or includes a service name that does not match the service * type. */ public Version(Class<? extends Service> serviceClass, String versionDescription, Version ... impliedVersions) throws IllegalArgumentException { this.serviceClass = serviceClass; Matcher matcher = VERSION_PROPERTY_PATTERN.matcher(versionDescription); if (!matcher.matches()) { throw new IllegalArgumentException( "Version description does not match expected format" + "[{service}]{major}[.{minor}]:" + versionDescription); } String minorValue = matcher.group(3); major = Integer.parseInt(matcher.group(2)); minor = (minorValue != null) ? Integer.parseInt(minorValue.substring(1)) : ANY; // Compute the full list of implied versions computeImpliedVersions(impliedVersions); }