net.sf.andromedaioc.bean.converter.fromboolean.FromBooleanConverterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of andromeda-ioc Show documentation
Show all versions of andromeda-ioc Show documentation
Inversion of Control Framework for Android
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);
}
}