public static LibertyVersionRange valueOf ( String versionRangeString ) { if ( versionRangeString == null ) { return null ; } Matcher versionRangeMatcher = VERSION_RANGE_PATTERN . matcher ( versionRangeString ) ; if ( versionRangeMatcher . matches ( ) ) { // Have a min and max so parse both LibertyVersion minVersion = LibertyVersion . valueOf ( versionRangeMatcher . group ( 1 ) ) ; LibertyVersion maxVersion = LibertyVersion . valueOf ( versionRangeMatcher . group ( 2 ) ) ; // Make sure both were valid versions if ( minVersion != null && maxVersion != null ) { return new LibertyVersionRange ( minVersion , maxVersion ) ; } else { return null ; } } else { // It's not a range so see if it's a single version LibertyVersion minVersion = LibertyVersion . valueOf ( versionRangeString ) ; if ( minVersion != null ) { return new LibertyVersionRange ( minVersion , null ) ; } else { return null ; } } }
Attempts to parse the supplied version range string into a Liberty version range containing just numbers . If it fails to do so it will return null .