@Test public void findTypeConverter() { assertTrue(TypeConverterFactory.getInstance().findTypeConverter(new UnsupportedDatabase()) instanceof DefaultTypeConverter); assertTrue(TypeConverterFactory.getInstance().findTypeConverter(new H2Database()) instanceof H2TypeConverter); }
public TypeConverter findTypeConverter(Database database) { SortedSet<TypeConverter> converters = new TreeSet<TypeConverter>(new Comparator<TypeConverter>() { public int compare(TypeConverter o1, TypeConverter o2) { return Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); } }); for (TypeConverter converter : allConverters) { if (converter.supports(database)) { converters.add(converter); } } return converters.last(); }
TypeConverterFactory { public TypeConverter findTypeConverter(Database database) { SortedSet<TypeConverter> converters = new TreeSet<TypeConverter>(new Comparator<TypeConverter>() { public int compare(TypeConverter o1, TypeConverter o2) { return Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); } }); for (TypeConverter converter : allConverters) { if (converter.supports(database)) { converters.add(converter); } } return converters.last(); } }
TypeConverterFactory { public TypeConverter findTypeConverter(Database database) { SortedSet<TypeConverter> converters = new TreeSet<TypeConverter>(new Comparator<TypeConverter>() { public int compare(TypeConverter o1, TypeConverter o2) { return Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); } }); for (TypeConverter converter : allConverters) { if (converter.supports(database)) { converters.add(converter); } } return converters.last(); } private  TypeConverterFactory(); }
TypeConverterFactory { public TypeConverter findTypeConverter(Database database) { SortedSet<TypeConverter> converters = new TreeSet<TypeConverter>(new Comparator<TypeConverter>() { public int compare(TypeConverter o1, TypeConverter o2) { return Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); } }); for (TypeConverter converter : allConverters) { if (converter.supports(database)) { converters.add(converter); } } return converters.last(); } private  TypeConverterFactory(); static TypeConverterFactory getInstance(); TypeConverter findTypeConverter(Database database); void register(TypeConverter typeConverter); void register(Class<? extends TypeConverter> typeConverterClass); }
TypeConverterFactory { public TypeConverter findTypeConverter(Database database) { SortedSet<TypeConverter> converters = new TreeSet<TypeConverter>(new Comparator<TypeConverter>() { public int compare(TypeConverter o1, TypeConverter o2) { return Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); } }); for (TypeConverter converter : allConverters) { if (converter.supports(database)) { converters.add(converter); } } return converters.last(); } private  TypeConverterFactory(); static TypeConverterFactory getInstance(); TypeConverter findTypeConverter(Database database); void register(TypeConverter typeConverter); void register(Class<? extends TypeConverter> typeConverterClass);  }