public static Optional < SaltVersion > parse ( String versionString ) { Matcher matcher = SALT_VERSION_REGEX . matcher ( versionString ) ; if ( matcher . matches ( ) ) { int year = Integer . parseInt ( matcher . group ( 1 ) ) ; int month = Integer . parseInt ( matcher . group ( 2 ) ) ; int bugfix = Integer . parseInt ( matcher . group ( 3 ) ) ; Optional < Integer > rc = Optional . ofNullable ( matcher . group ( 5 ) ) . map ( Integer :: parseInt ) ; return Optional . of ( new SaltVersion ( year , month , bugfix , rc ) ) ; } else { return Optional . empty ( ) ; } }
Parses a salt version string