public static Long dehumanize ( String time ) { Long result = getHumantimeCache ( ) . get ( time ) ; if ( result == null ) { if ( isNotBlank ( time ) ) { String input = time . trim ( ) ; if ( NumberUtils . isDigits ( input ) ) { result = NumberUtils . toLong ( input ) ; } else { Matcher matcher = PATTERN_HUMAN_TIME . matcher ( input ) ; if ( matcher . matches ( ) ) { long sum = 0L ; sum += dehumanizeUnit ( matcher . group ( 1 ) , MS_WEEK ) ; sum += dehumanizeUnit ( matcher . group ( 2 ) , MS_DAY ) ; sum += dehumanizeUnit ( matcher . group ( 3 ) , MS_HOUR ) ; sum += dehumanizeUnit ( matcher . group ( 4 ) , MS_MINUTE ) ; sum += dehumanizeUnit ( matcher . group ( 5 ) , MS_SECOND ) ; sum += dehumanizeUnit ( matcher . group ( 6 ) , MS_MILLISECOND ) ; result = sum ; } } getHumantimeCache ( ) . put ( time , result ) ; } } return result ; }
Converts a human readable duration in the format Xd Xh Xm Xs Xms to miliseconds .