final Integer [ ] getDateValues ( String filePath , Formatter formatter ) { Pattern pattern = defaultPathPattern ; switch ( formatter ) { case DEFAULT : case LOWER_DEFAULT : break ; case HIVE : pattern = hivePathPattern ; break ; default : throw new IAE ( "Format %s not supported" , formatter ) ; } Matcher matcher = pattern . matcher ( filePath ) ; // The size is "7" b/c this array contains standard // datetime field values namely: // year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute, // and index 0 is unused. Integer [ ] vals = new Integer [ 7 ] ; if ( matcher . matches ( ) ) { for ( int i = 1 ; i <= matcher . groupCount ( ) ; i ++ ) { vals [ i ] = ( matcher . group ( i ) != null ) ? Integer . parseInt ( matcher . group ( i ) ) : null ; } } return vals ; }
Used by the toDate implementations .