/** * Lookup a default converter. * * @return A {@link Converter} between the given types, or else {@code null} if no such default converter exists. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static <M, W> Converter<M, W> getConverter(final Class<M> modelValueType, final Class<W> componentValueType) { Converter converter = defaultConverters.get(new ConverterRegistrationKey(modelValueType, componentValueType)); if (converter == null) { converter = maybeCreateBuiltinConverter(maybeBoxPrimitive(modelValueType), maybeBoxPrimitive(componentValueType)); } return converter; }
/** * Registers a {@link Converter} as a default for the provided model and widget types. The default converter will be * used in case no custom converter is provided when binding a model to a widget. * * @param <M> * The type of the model value (field type of the model) * @param <W> * The type of the widget value (e.g. String for a {@link TextBox} (=HasValue<String>) or Boolean for a * {@link Checkbox} (=HasValue<Boolean>))) * @param modelValueType * The model type the provided converter converts to, must not be null. * @param widgetValueType * The widget type the provided converter converts to, must not be null. * @param converter * The converter to register as a default for the provided model and widget types. */ public static <M, W> void registerDefaultConverter(final Class<M> modelValueType, final Class<W> widgetValueType, final Converter<M, W> converter) { Assert.notNull(modelValueType); Assert.notNull(widgetValueType); defaultConverters.put(new ConverterRegistrationKey(modelValueType, widgetValueType), converter); }
/** * Registers a {@link Converter} as a default for the provided model and widget types. The default converter will be * used in case no custom converter is provided when binding a model to a widget. * * @param <M> * The type of the model value (field type of the model) * @param <W> * The type of the widget value (e.g. String for a {@link TextBox} (=HasValue<String>) or Boolean for a * {@link Checkbox} (=HasValue<Boolean>))) * @param modelValueType * The model type the provided converter converts to, must not be null. * @param widgetValueType * The widget type the provided converter converts to, must not be null. * @param converter * The converter to register as a default for the provided model and widget types. */ public static <M, W> void registerDefaultConverter(final Class<M> modelValueType, final Class<W> widgetValueType, final Converter<M, W> converter) { Assert.notNull(modelValueType); Assert.notNull(widgetValueType); defaultConverters.put(new ConverterRegistrationKey(modelValueType, widgetValueType), converter); }
/** * Registers a {@link Converter} as a default for the provided model and widget types. The default converter will be * used in case no custom converter is provided when binding a model to a widget. * * @param <M> * The type of the model value (field type of the model) * @param <W> * The type of the widget value (e.g. String for a {@link TextBox} (=HasValue<String>) or Boolean for a * {@link Checkbox} (=HasValue<Boolean>))) * @param modelValueType * The model type the provided converter converts to, must not be null. * @param widgetValueType * The widget type the provided converter converts to, must not be null. * @param converter * The converter to register as a default for the provided model and widget types. */ public static <M, W> void registerDefaultConverter(final Class<M> modelValueType, final Class<W> widgetValueType, final Converter<M, W> converter) { Assert.notNull(modelValueType); Assert.notNull(widgetValueType); defaultConverters.put(new ConverterRegistrationKey(modelValueType, widgetValueType), converter); }
/** * Lookup a default converter. * * @return A {@link Converter} between the given types, or else {@code null} if no such default converter exists. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static <M, W> Converter<M, W> getConverter(final Class<M> modelValueType, final Class<W> componentValueType) { Converter converter = defaultConverters.get(new ConverterRegistrationKey(modelValueType, componentValueType)); if (converter == null) { converter = maybeCreateBuiltinConverter(maybeBoxPrimitive(modelValueType), maybeBoxPrimitive(componentValueType)); } return converter; }
/** * Lookup a default converter. * * @return A {@link Converter} between the given types, or else {@code null} if no such default converter exists. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static <M, W> Converter<M, W> getConverter(final Class<M> modelValueType, final Class<W> componentValueType) { Converter converter = defaultConverters.get(new ConverterRegistrationKey(modelValueType, componentValueType)); if (converter == null) { converter = maybeCreateBuiltinConverter(maybeBoxPrimitive(modelValueType), maybeBoxPrimitive(componentValueType)); } return converter; }