/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.converter;

import org.apache.camel.Exchange;
import org.apache.camel.TypeConversionException;
import org.apache.camel.TypeConverterLoaderException;
import org.apache.camel.spi.TypeConverterLoader;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.support.SimpleTypeConverter;
import org.apache.camel.support.TypeConverterSupport;
import org.apache.camel.util.DoubleMap;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
@SuppressWarnings("unchecked")
public final class CollectionConverterLoader implements TypeConverterLoader {

    public CollectionConverterLoader() {
    }

    @Override
    public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
        registerConverters(registry);
    }

    private void registerConverters(TypeConverterRegistry registry) {
        addTypeConverter(registry, java.lang.Object[].class, java.util.Collection.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toArray((java.util.Collection) value));
        addTypeConverter(registry, java.util.ArrayList.class, java.util.Iterator.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toArrayList((java.util.Iterator) value));
        addTypeConverter(registry, java.util.HashMap.class, java.util.Map.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toHashMap((java.util.Map) value));
        addTypeConverter(registry, java.util.Hashtable.class, java.util.Map.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toHashtable((java.util.Map) value));
        addTypeConverter(registry, java.util.List.class, java.lang.Iterable.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toList((java.lang.Iterable) value));
        addTypeConverter(registry, java.util.List.class, java.lang.Object[].class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toList((java.lang.Object[]) value));
        addTypeConverter(registry, java.util.List.class, java.util.Collection.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toList((java.util.Collection) value));
        addTypeConverter(registry, java.util.Properties.class, java.util.Map.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toProperties((java.util.Map) value));
        addTypeConverter(registry, java.util.Set.class, java.lang.Object[].class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toSet((java.lang.Object[]) value));
        addTypeConverter(registry, java.util.Set.class, java.util.Collection.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toSet((java.util.Collection) value));
        addTypeConverter(registry, java.util.Set.class, java.util.Map.class, false,
            (type, exchange, value) -> org.apache.camel.converter.CollectionConverter.toSet((java.util.Map) value));
    }

    private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) { 
        registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method));
    }

}
