All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.andromedaioc.bean.converter.fromboolean.FromBooleanConverterFactory Maven / Gradle / Ivy

The newest version!
package net.sf.andromedaioc.bean.converter.fromboolean;

import net.sf.andromedaioc.bean.converter.Converter;
import net.sf.andromedaioc.bean.converter.FromConverterFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * From Boolean converter factory
 *
 * @author Alexey Mitrov
 */
public class FromBooleanConverterFactory implements FromConverterFactory {

    private final Map, Converter> converters;

    public FromBooleanConverterFactory() {
        converters = new HashMap, Converter>();
        FromBooleanToBooleanConverter fromBooleanToBooleanConverter = new FromBooleanToBooleanConverter();
        converters.put(Boolean.class, fromBooleanToBooleanConverter);
        converters.put(boolean.class, fromBooleanToBooleanConverter);
        FromBooleanToByteConverter fromBooleanToByteConverter = new FromBooleanToByteConverter();
        converters.put(Byte.class, fromBooleanToByteConverter);
        converters.put(byte.class, fromBooleanToByteConverter);
        FromBooleanToShortConverter fromBooleanToShortConverter = new FromBooleanToShortConverter();
        converters.put(Short.class, fromBooleanToShortConverter);
        converters.put(short.class, fromBooleanToShortConverter);
        FromBooleanToIntegerConverter fromBooleanToIntegerConverter = new FromBooleanToIntegerConverter();
        converters.put(Integer.class, fromBooleanToIntegerConverter);
        converters.put(int.class, fromBooleanToIntegerConverter);
        FromBooleanToFloatConverter fromBooleanToFloatConverter = new FromBooleanToFloatConverter();
        converters.put(Float.class, fromBooleanToFloatConverter);
        converters.put(float.class, fromBooleanToFloatConverter);
        FromBooleanToDoubleConverter fromBooleanToDoubleConverter = new FromBooleanToDoubleConverter();
        converters.put(Double.class, fromBooleanToDoubleConverter);
        converters.put(double.class, fromBooleanToDoubleConverter);
        converters.put(String.class, new FromBooleanToStringConverter());
    }

    public  Converter getConverter(Class toType) {
        return (Converter) converters.get(toType);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy