private Strategy getStrategy ( final char f , final int width , final Calendar definingCalendar ) { switch ( f ) { default : throw new IllegalArgumentException ( "Format '" + f + "' not supported" ) ; case ' ' : return DAY_OF_YEAR_STRATEGY ; case ' ' : return getLocaleSpecificStrategy ( Calendar . DAY_OF_WEEK , definingCalendar ) ; case ' ' : return DAY_OF_WEEK_IN_MONTH_STRATEGY ; case ' ' : return getLocaleSpecificStrategy ( Calendar . ERA , definingCalendar ) ; case ' ' : // Hour in day (0-23) return HOUR_OF_DAY_STRATEGY ; case ' ' : // Hour in am/pm (0-11) return HOUR_STRATEGY ; case ' ' : return width >= 3 ? getLocaleSpecificStrategy ( Calendar . MONTH , definingCalendar ) : NUMBER_MONTH_STRATEGY ; case ' ' : return MILLISECOND_STRATEGY ; case ' ' : return WEEK_OF_MONTH_STRATEGY ; case ' ' : return getLocaleSpecificStrategy ( Calendar . AM_PM , definingCalendar ) ; case ' ' : return DAY_OF_MONTH_STRATEGY ; case ' ' : // Hour in am/pm (1-12), i.e. midday/midnight is 12, not 0 return HOUR12_STRATEGY ; case ' ' : // Hour in day (1-24), i.e. midnight is 24, not 0 return HOUR24_OF_DAY_STRATEGY ; case ' ' : return MINUTE_STRATEGY ; case ' ' : return SECOND_STRATEGY ; case ' ' : return DAY_OF_WEEK_STRATEGY ; case ' ' : return WEEK_OF_YEAR_STRATEGY ; case ' ' : case ' ' : return width > 2 ? LITERAL_YEAR_STRATEGY : ABBREVIATED_YEAR_STRATEGY ; case ' ' : return ISO8601TimeZoneStrategy . getStrategy ( width ) ; case ' ' : if ( width == 2 ) { return ISO8601TimeZoneStrategy . ISO_8601_3_STRATEGY ; } //$FALL-THROUGH$ case ' ' : return getLocaleSpecificStrategy ( Calendar . ZONE_OFFSET , definingCalendar ) ; } }
Obtain a Strategy given a field from a SimpleDateFormat pattern