private void removeComponentDefaultProperties()

in src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigurationSerializerWebConsolePlugin.java [362:378]


    private void removeComponentDefaultProperties(final Collection<ComponentDescriptionDTO> componentDescriptions, final String pid, final String factoryPid, final Dictionary<String, Object> dict, final Dictionary<String, Object> mergedProperties) {
        String effectivePid = factoryPid != null ? factoryPid : pid;
        Collection<ComponentDescriptionDTO> relevantComponentDescriptions = componentDescriptions.stream()
            // find all with a matching pid
            .filter(c -> Arrays.asList(c.configurationPid).contains(effectivePid)).collect(Collectors.toList());

        final Enumeration<String> e = dict.keys();
        while(e.hasMoreElements()) {
            final String key = e.nextElement();
            final Object newValue = dict.get(key);
            if (relevantComponentDescriptions.stream()
                    .allMatch(c -> ConfigUtil.isSameValue(newValue, c.properties.get(key)) 
                                   && mergedProperties.get(key) == null)) {
                dict.remove(key);
            }
        }
    }