public static Version . Field getMostSpecificMatchingField ( Version v1 , Version v2 ) { if ( v1 . getMajor ( ) != v2 . getMajor ( ) ) { return null ; } if ( v1 . getMinor ( ) != v2 . getMinor ( ) ) { return Version . Field . MAJOR ; } if ( v1 . getPatch ( ) != v2 . getPatch ( ) ) { return Version . Field . MINOR ; } final Integer l1 = v1 . getLocal ( ) ; final Integer l2 = v2 . getLocal ( ) ; if ( l1 != l2 && ( l1 == null || l2 == null || ! l1 . equals ( l2 ) ) ) { return Version . Field . PATCH ; } return Version . Field . LOCAL ; }
Determine how much of two versions match . Returns null if the versions do not match at all .