/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.hbase.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 HBaseModelConverterLoader implements TypeConverterLoader {

    public HBaseModelConverterLoader() {
    }

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

    private void registerConverters(TypeConverterRegistry registry) {
        addTypeConverter(registry, byte[].class, java.lang.Boolean.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.booleanToBytes((java.lang.Boolean) value));
        addTypeConverter(registry, byte[].class, java.lang.Double.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.doubleToBytes((java.lang.Double) value));
        addTypeConverter(registry, byte[].class, java.lang.Float.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.floatToBytes((java.lang.Float) value));
        addTypeConverter(registry, byte[].class, java.lang.Integer.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.integerToBytes((java.lang.Integer) value));
        addTypeConverter(registry, byte[].class, java.lang.Long.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.longToBytes((java.lang.Long) value));
        addTypeConverter(registry, byte[].class, java.lang.Short.class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.shortToBytes((java.lang.Short) value));
        addTypeConverter(registry, java.lang.Boolean.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToBoolean((byte[]) value));
        addTypeConverter(registry, java.lang.Double.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToDouble((byte[]) value));
        addTypeConverter(registry, java.lang.Float.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToFloat((byte[]) value));
        addTypeConverter(registry, java.lang.Integer.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToInteger((byte[]) value));
        addTypeConverter(registry, java.lang.Long.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToLong((byte[]) value));
        addTypeConverter(registry, java.lang.Short.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.component.hbase.converter.HBaseModelConverter.bytesToShort((byte[]) value));
    }

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

}
