Constructor and Description |
---|
Convert() |
Modifier and Type | Method and Description |
---|---|
static void |
deregisterDefaultConverters()
Deletes all registrations of default converters.
|
static <M,W> void |
registerDefaultConverter(Class<M> modelValueType,
Class<W> widgetValueType,
Converter<M,W> converter)
Registers a
Converter as a default for the provided model and widget types. |
static Object |
to(Class<?> toType,
Object o)
Converts the provided object to the provided type.
|
static <M,W> M |
toModelValue(Class<M> modelValueType,
Class<W> widgetValueType,
W widgetValue,
Converter<M,W> converter)
Converts the provided object to a model value.
|
static <M,W> M |
toModelValue(Class<M> modelValueType,
com.google.gwt.user.client.ui.Widget widget,
W widgetValue,
Converter<M,W> converter)
Converts the provided object to a model value.
|
static <M,W> W |
toWidgetValue(Class<W> widgetValueType,
Class<M> modelValueType,
M modelValue,
Converter<M,W> converter)
Converts the provided object to a widget value.
|
static <M,W> W |
toWidgetValue(com.google.gwt.user.client.ui.Widget widget,
Class<M> modelValueType,
M modelValue,
Converter<M,W> converter)
Converts the provided object to a widget value.
|
public static Object to(Class<?> toType, Object o)
This method is used in case no Converter
has been specified for the binding (see
DataBinder.bind(Widget, String, Converter)
) and no default converter has been registered for the
corresponding types (see registerDefaultConverter(Class, Class, Converter)
).
toType
- The type to convert to, must not be null.o
- The object to convert. Null allowed. If toType is String.class, null values will be represented as empty
Strings.public static <M,W> W toWidgetValue(com.google.gwt.user.client.ui.Widget widget, Class<M> modelValueType, M modelValue, Converter<M,W> converter)
M
- The type of the model value (field type of the model)W
- The type of the widget value (e.g. String for a TextBox
(=HasValue<String>) or Boolean for a
Checkbox
(=HasValue<Boolean>)))widget
- The widget holding the value, used to determine the value type. Must not be null.modelValueType
- The model type, used to lookup global default converters. Must not be null.modelValue
- The value to convert.converter
- The converter to use, null if default conversion should be used.public static <M,W> W toWidgetValue(Class<W> widgetValueType, Class<M> modelValueType, M modelValue, Converter<M,W> converter)
M
- The type of the model value (field type of the model)W
- The type of the widget value (e.g. String for a TextBox
(=HasValue<String>) or Boolean for a
Checkbox
(=HasValue<Boolean>)))widgetValueType
- The type to convert to. Must not be null.modelValueType
- The model type, used to lookup global default converters. Must not be null.modelValue
- The value to convert.converter
- The converter to use, null if default conversion should be used.public static <M,W> M toModelValue(Class<M> modelValueType, com.google.gwt.user.client.ui.Widget widget, W widgetValue, Converter<M,W> converter)
M
- The type of the model value (field type of the model)W
- The type of the widget value (e.g. String for a TextBox
(=HasValue<String>) or Boolean for a
Checkbox
(=HasValue<Boolean>)))modelValueType
- The type to convert to. Must not be null.widget
- The widget holding the value, used to determine the value type. Must not be null.widgetValue
- The value to convert.converter
- The converter to use, null if default conversion should be used.public static <M,W> M toModelValue(Class<M> modelValueType, Class<W> widgetValueType, W widgetValue, Converter<M,W> converter)
M
- The type of the model value (field type of the model)W
- The type of the widget value (e.g. String for a TextBox
(=HasValue<String>) or Boolean for a
Checkbox
(=HasValue<Boolean>)))modelValueType
- The type to convert to. Must not be null.widgetValueType
- The widget type, use to lookup global default converters. Must not be null.widgetValue
- The value to convert.converter
- The converter to use, null if default conversion should be used.public static <M,W> void registerDefaultConverter(Class<M> modelValueType, Class<W> widgetValueType, Converter<M,W> converter)
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.M
- The type of the model value (field type of the model)W
- The type of the widget value (e.g. String for a TextBox
(=HasValue<String>) or Boolean for a
Checkbox
(=HasValue<Boolean>)))modelValueType
- The model type the provided converter converts to, must not be null.widgetValueType
- The widget type the provided converter converts to, must not be null.converter
- The converter to register as a default for the provided model and widget types.public static void deregisterDefaultConverters()
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.