1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.configuration.internal;
20
21 import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
22 import org.codehaus.plexus.component.configurator.converters.ConfigurationConverter;
23 import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter;
24 import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
25 import org.codehaus.plexus.component.configurator.converters.lookup.DefaultConverterLookup;
26
27 class EnhancedConverterLookup implements ConverterLookup {
28 private final ConverterLookup delegate = new DefaultConverterLookup();
29
30 EnhancedConverterLookup() {
31 registerConverter(new DefaultBeanConfigurator.PathConverter());
32 registerConverter(new DefaultBeanConfigurator.XmlConverter());
33 }
34
35 @Override
36 public void registerConverter(ConfigurationConverter converter) {
37 delegate.registerConverter(converter);
38 }
39
40 @Override
41 public ConfigurationConverter lookupConverterForType(Class<?> type) throws ComponentConfigurationException {
42 ConfigurationConverter converter = delegate.lookupConverterForType(type);
43 return converter.getClass().equals(ObjectWithFieldsConverter.class)
44 ? new EnhancedConfigurationConverter()
45 : converter;
46 }
47 }