/** * Returns a version that matches the input service type and major version but * {@link #ANY} minor version. * * @param v input version type * @return equivalent version with any minor version */ public static Version anyMinorVersionOf(Version v) { return new Version(v.getServiceClass(), v.getMajor(), Version.ANY); }
/** * Returns a version that matches the input service type and major version but * {@link #ANY} minor version. * * @param v input version type * @return equivalent version with any minor version */ public static Version anyMinorVersionOf(Version v) { return new Version(v.getServiceClass(), v.getMajor(), Version.ANY); }
/** * Returns a version that matches the input service type and major version but * {@link #ANY} minor version. * * @param v input version type * @return equivalent version with any minor version */ public static Version anyMinorVersionOf(Version v) { return new Version(v.getServiceClass(), v.getMajor(), Version.ANY); }
/** * Compares two versions, where either may be null. */ static int compareVersion(Version a, Version b) { if (a == b) { return 0; } if (a == null) { return -1; } if (b == null) { return 1; } int compare = MetadataKey.compareClass( a.getServiceClass(), b.getServiceClass()); if (compare != 0) { return compare; } int aMajor = a.getMajor(); int bMajor = b.getMajor(); if (aMajor != bMajor) { return aMajor < bMajor ? -1 : 1; } int aMinor = a.getMinor(); int bMinor = b.getMinor(); return aMinor < bMinor ? -1 : (aMinor == bMinor ? 0 : 1); }
/** * Compares two versions, where either may be null. */ static int compareVersion(Version a, Version b) { if (a == b) { return 0; } if (a == null) { return -1; } if (b == null) { return 1; } int compare = MetadataKey.compareClass( a.getServiceClass(), b.getServiceClass()); if (compare != 0) { return compare; } int aMajor = a.getMajor(); int bMajor = b.getMajor(); if (aMajor != bMajor) { return aMajor < bMajor ? -1 : 1; } int aMinor = a.getMinor(); int bMinor = b.getMinor(); return aMinor < bMinor ? -1 : (aMinor == bMinor ? 0 : 1); }
/** * Compares two versions, where either may be null. */ static int compareVersion(Version a, Version b) { if (a == b) { return 0; } if (a == null) { return -1; } if (b == null) { return 1; } int compare = MetadataKey.compareClass( a.getServiceClass(), b.getServiceClass()); if (compare != 0) { return compare; } int aMajor = a.getMajor(); int bMajor = b.getMajor(); if (aMajor != bMajor) { return aMajor < bMajor ? -1 : 1; } int aMinor = a.getMinor(); int bMinor = b.getMinor(); return aMinor < bMinor ? -1 : (aMinor == bMinor ? 0 : 1); }