|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.errai.databinding.client.api.Convert
public class Convert
Type conversion utility used by the generated Bindable
proxies.
Constructor Summary | |
---|---|
Convert()
|
Method Summary | ||
---|---|---|
static void |
deregisterDefaultConverters()
Deletes all registrations of default converters. |
|
static
|
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
|
toModelValue(Class<M> modelValueType,
Class<W> widgetValueType,
W widgetValue,
Converter<M,W> converter)
Converts the provided object to a model value. |
|
static
|
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
|
toWidgetValue(Class<W> widgetValueType,
Class<M> modelValueType,
M modelValue,
Converter<M,W> converter)
Converts the provided object to a widget value. |
|
static
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Convert()
Method Detail |
---|
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()
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |