private String [ ] resolveAltIds ( String [ ] oldArray , String mimeType , int count ) { // First, find the valid list we want String key = null ; for ( String mimeTest : attachAltIds . keySet ( ) ) { // Ignore 'default' if ( mimeTest . equals ( Strings . LITERAL_DEFAULT ) ) { continue ; } // Is it a broad group? if ( mimeTest . endsWith ( "/" ) ) { if ( mimeType . startsWith ( mimeTest ) ) { key = mimeTest ; } // Or a specific mime type? } else { if ( mimeType . equals ( mimeTest ) ) { key = mimeTest ; } } } // Use default if not found if ( key == null ) { key = Strings . LITERAL_DEFAULT ; } // Loop through the ids we're going to use for ( String newId : attachAltIds . get ( key ) ) { // If there is a format requirement, use it String formatted = String . format ( newId , count ) ; // Modify our arrray (if we it's not there) oldArray = growArray ( oldArray , formatted ) ; } return oldArray ; }
For the given mime type ensure that the array of alternate identifiers is correct . If identifiers are missing they will be added to the array .