private synchronized String formatPattern ( Pattern pat , String ... args ) { if ( _patternFormatters == null ) { _patternFormatters = new MessageFormat [ Pattern . values ( ) . length ] ; } int idx = pat . ordinal ( ) ; if ( _patternFormatters [ idx ] == null ) { String patText ; try { ICUResourceBundle bundle = ( ICUResourceBundle ) ICUResourceBundle . getBundleInstance ( ICUData . ICU_ZONE_BASE_NAME , _locale ) ; patText = bundle . getStringWithFallback ( "zoneStrings/" + pat . key ( ) ) ; } catch ( MissingResourceException e ) { patText = pat . defaultValue ( ) ; } _patternFormatters [ idx ] = new MessageFormat ( patText ) ; } return _patternFormatters [ idx ] . format ( args ) ; }
Private simple pattern formatter used for formatting generic location names and partial location names . We intentionally use JDK MessageFormat for performance reason .