@Test public void testGetOsgiMMM() { assertThat( Version.getOsgiMMM( "1.0", false ), equalTo( "1.0" ) ); assertThat( Version.getOsgiMMM( "1.0", true ), equalTo( "1.0.0" ) ); assertThat( Version.getOsgiMMM( "13_2-43", false ), equalTo( "13.2.43" ) ); assertThat( Version.getOsgiMMM( "1", false ), equalTo( "1" ) ); assertThat( Version.getOsgiMMM( "2", true ), equalTo( "2.0.0" ) ); assertThat( Version.getOsgiMMM( "beta1", false ), equalTo( "" ) ); assertThat( Version.getOsgiMMM( "GA-1-GA-foo", true ), equalTo( "" ) ); assertThat( Version.getOsgiMMM( "1.2.3.foo-final-1", true ), equalTo( "1.2.3" ) ); assertThat( Version.getOsgiMMM( "1.2.final-1", true ), equalTo( "1.2.0" ) ); }
static String getOsgiMMM(String version, boolean fill) { String mmm = getMMM( version ); Matcher mmmMatcher = mmmPattern.matcher( mmm ); if ( mmmMatcher.matches() ) { String osgiMMM = mmmMatcher.group( 1 ); String minorVersion = mmmMatcher.group( 3 ); if ( !isEmpty( minorVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + minorVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } String microVersion = mmmMatcher.group( 5 ); if ( !isEmpty( microVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + microVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } return osgiMMM; } return EMPTY_STRING; }
Version { static String getOsgiMMM(String version, boolean fill) { String mmm = getMMM( version ); Matcher mmmMatcher = mmmPattern.matcher( mmm ); if ( mmmMatcher.matches() ) { String osgiMMM = mmmMatcher.group( 1 ); String minorVersion = mmmMatcher.group( 3 ); if ( !isEmpty( minorVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + minorVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } String microVersion = mmmMatcher.group( 5 ); if ( !isEmpty( microVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + microVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } return osgiMMM; } return EMPTY_STRING; } }
Version { static String getOsgiMMM(String version, boolean fill) { String mmm = getMMM( version ); Matcher mmmMatcher = mmmPattern.matcher( mmm ); if ( mmmMatcher.matches() ) { String osgiMMM = mmmMatcher.group( 1 ); String minorVersion = mmmMatcher.group( 3 ); if ( !isEmpty( minorVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + minorVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } String microVersion = mmmMatcher.group( 5 ); if ( !isEmpty( microVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + microVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } return osgiMMM; } return EMPTY_STRING; } private  Version(); }
Version { static String getOsgiMMM(String version, boolean fill) { String mmm = getMMM( version ); Matcher mmmMatcher = mmmPattern.matcher( mmm ); if ( mmmMatcher.matches() ) { String osgiMMM = mmmMatcher.group( 1 ); String minorVersion = mmmMatcher.group( 3 ); if ( !isEmpty( minorVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + minorVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } String microVersion = mmmMatcher.group( 5 ); if ( !isEmpty( microVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + microVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } return osgiMMM; } return EMPTY_STRING; } private  Version(); static String getBuildNumber(String version); static int getBuildNumberPadding( int incrementalSerialSuffixPadding, Set<String> versions ); static String getMMM(String version); static String getOsgiVersion(String version); static String getQualifier(String version); static String getQualifierBase(String version); static String getQualifierWithDelim(String version); static String getSnapshot( String version ); static String getSnapshotWithDelim( String version ); static boolean hasBuildNumber( String version ); static boolean hasQualifier( String version ); static boolean isEmpty( String string ); static boolean isSnapshot( String version ); static boolean isValidOSGi(String version); static String removeBuildNumber( String version ); static String removeSnapshot( String version ); static String appendQualifierSuffix( final String version, final String suffix ); static String setBuildNumber( String version, String buildNumber ); static String setSnapshot( String version, boolean snapshot ); static int findHighestMatchingBuildNumber(String version, Set<String> versionSet ); static int getIntegerBuildNumber( String version ); }
Version { static String getOsgiMMM(String version, boolean fill) { String mmm = getMMM( version ); Matcher mmmMatcher = mmmPattern.matcher( mmm ); if ( mmmMatcher.matches() ) { String osgiMMM = mmmMatcher.group( 1 ); String minorVersion = mmmMatcher.group( 3 ); if ( !isEmpty( minorVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + minorVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } String microVersion = mmmMatcher.group( 5 ); if ( !isEmpty( microVersion ) ) { osgiMMM += OSGI_VERSION_DELIMITER + microVersion; } else if ( fill ) { osgiMMM += OSGI_VERSION_DELIMITER + "0"; } return osgiMMM; } return EMPTY_STRING; } private  Version(); static String getBuildNumber(String version); static int getBuildNumberPadding( int incrementalSerialSuffixPadding, Set<String> versions ); static String getMMM(String version); static String getOsgiVersion(String version); static String getQualifier(String version); static String getQualifierBase(String version); static String getQualifierWithDelim(String version); static String getSnapshot( String version ); static String getSnapshotWithDelim( String version ); static boolean hasBuildNumber( String version ); static boolean hasQualifier( String version ); static boolean isEmpty( String string ); static boolean isSnapshot( String version ); static boolean isValidOSGi(String version); static String removeBuildNumber( String version ); static String removeSnapshot( String version ); static String appendQualifierSuffix( final String version, final String suffix ); static String setBuildNumber( String version, String buildNumber ); static String setSnapshot( String version, boolean snapshot ); static int findHighestMatchingBuildNumber(String version, Set<String> versionSet ); static int getIntegerBuildNumber( String version ); static final String PROJECT_VERSION; }