| CODENOTIFIER | HelpYou are not signed inSign in |
Project: UFace
Revision: 2261
Author: kenneth.westelinck
Date: 17 Aug 2008 04:23:22
Changes:Javadoc
Files:| ... | ...@@ -18,7 +18,7 @@ | |
| 18 | 18 | */ |
| 19 | 19 | public interface UIConverterFactoryRegistry { |
| 20 | 20 | /** |
| 21 | * Register a converter factory with this registry. | |
| 21 | * Register a converter factory ({@link UIConverterFactory}) with this registry. | |
| 22 | 22 | * |
| 23 | 23 | * @param converterFactory |
| 24 | 24 | * factory to be registered |
| ... | ...@@ -27,7 +27,7 @@ | |
| 27 | 27 | UIConverterFactoryRegistry registerConverterFactory(UIConverterFactory converterFactory); |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | * Get a converter factory that can create a converter, capable of | |
| 30 | * Get a converter factory ({@link UIConverterFactory}) that can create a converter, capable of | |
| 31 | 31 | * converting from modelType to targetType and vice versa. |
| 32 | 32 | * |
| 33 | 33 | * @param modelType |
| ... | ...@@ -16,19 +16,35 @@ | |
| 16 | 16 | import org.ufacekit.ui.conversion.UIConverterFactory; |
| 17 | 17 | import org.ufacekit.ui.conversion.UIConverterFactoryRegistry; |
| 18 | 18 | |
| 19 | ||
| 19 | /** | |
| 20 | * Default implementation for a {@link UIConverterFactoryRegistry} backed by a | |
| 21 | * simple {@link Map}. | |
| 22 | * | |
| 23 | * @since 1.0 | |
| 24 | */ | |
| 20 | 25 | public class DefaultUIConverterFactoryRegistry implements UIConverterFactoryRegistry { |
| 21 | 26 | private Map converterFactoryDictionary; |
| 22 | 27 | |
| 28 | /** | |
| 29 | * Constructor. | |
| 30 | * | |
| 31 | * @since 1.0 | |
| 32 | */ | |
| 23 | 33 | public DefaultUIConverterFactoryRegistry() { |
| 24 | 34 | this.converterFactoryDictionary = new HashMap(); |
| 25 | 35 | } |
| 26 | 36 | |
| 37 | /** | |
| 38 | * @see UIConverterFactoryRegistry#getConverterFactory(Object, Object) | |
| 39 | */ | |
| 27 | 40 | public UIConverterFactory getConverterFactory(Object modelType, Object targetType) { |
| 28 | 41 | Entry key = new Entry(modelType, targetType); |
| 29 | 42 | return (UIConverterFactory) this.converterFactoryDictionary.get(key); |
| 30 | 43 | } |
| 31 | 44 | |
| 45 | /** | |
| 46 | * @see UIConverterFactoryRegistry#registerConverterFactory(UIConverterFactory) | |
| 47 | */ | |
| 32 | 48 | public UIConverterFactoryRegistry registerConverterFactory(UIConverterFactory converterFactory) { |
| 33 | 49 | Entry key = new Entry(converterFactory.getModelType(), converterFactory.getTargetType()); |
| 34 | 50 | this.converterFactoryDictionary.put(key, converterFactory); |