protected Map < String , ConfigElementList > generateConflictMap ( RegistryEntry registryEntry , List < ? extends ConfigElement > list ) { if ( list . size ( ) <= 1 ) { return Collections . emptyMap ( ) ; } boolean foundConflict = false ; Map < String , ConfigElementList > conflictMap = new HashMap < String , ConfigElementList > ( ) ; for ( ConfigElement element : list ) { for ( Map . Entry < String , Object > entry : element . getAttributes ( ) . entrySet ( ) ) { String attributeName = entry . getKey ( ) ; Object attributeValue = entry . getValue ( ) ; // consider single-values attributes only if ( ! ( attributeValue instanceof String ) ) { continue ; } ConfigElementList configList = conflictMap . get ( attributeName ) ; if ( configList == null ) { configList = new ConfigElementList ( attributeName ) ; conflictMap . put ( attributeName , configList ) ; } if ( configList . add ( element ) ) { // Validation occurs within 'add'. foundConflict = true ; } } } if ( ! foundConflict ) { return Collections . emptyMap ( ) ; } else { return conflictMap ; } }
Look for conflicts between single - valued attributes of a list of configuration elements .