@ SuppressWarnings ( "unchecked" ) private void mergeConfigs ( Map < String , Map < String , ? > > configurationMap , Object parsed ) { if ( parsed instanceof Map ) { Map < ? , ? > parsedMap = ( Map < ? , ? > ) parsed ; for ( Object key : parsedMap . keySet ( ) ) { if ( key instanceof String ) { Map < String , Object > existingValue = ( Map < String , Object > ) configurationMap . get ( ( String ) key ) ; if ( ! configurationMap . containsKey ( ( String ) key ) ) { existingValue = new HashMap < String , Object > ( ) ; configurationMap . put ( ( String ) key , existingValue ) ; } Object parsedValue = parsedMap . get ( key ) ; if ( parsedValue instanceof Map ) { Map < ? , ? > parsedValueMap = ( Map < ? , ? > ) parsedValue ; for ( Object parsedKey : parsedValueMap . keySet ( ) ) { if ( parsedKey instanceof String ) { existingValue . put ( ( String ) parsedKey , parsedValueMap . get ( parsedKey ) ) ; } } } } } } }
Merges configurations from an Object into an existing Map .