public OptionalLong extractRevision ( String buildName ) { // Gets the regex for the pattern String regex = getRegex ( ) ; // Matching Matcher matcher = Pattern . compile ( regex ) . matcher ( buildName ) ; if ( matcher . matches ( ) ) { String token = matcher . group ( 1 ) ; return OptionalLong . of ( Long . parseLong ( token , 10 ) ) ; } else { return OptionalLong . empty ( ) ; } }
Extracts the revision from a build name .