【问题标题】:UiBinding.Binding returns NumberFormatException for DateUiBinding.Binding 为 Date 返回 NumberFormatException
【发布时间】:2017-10-14 14:03:04
【问题描述】:

我有一个实现 PropertyBusinessObject 的类。该类的属性之一是 Date,如图所示:

public class Appointment implements PropertyBusinessObject {
public final Property<Double, Appointment> id = new Property<>("id");
public final Property<Date, Appointment> bookDate = 
               new Property<> "bookDate", Date.class);

...

当我尝试以如下形式使用 UiBinding 时:

Appointment a = (Appointment) obj;
    for (UiBinding.Binding b : bindingList) {
        b.commit();           
    }

...

我得到 java.lang.NumberFormatException:对于输入字符串:“Thu Oct 12 20:21:20 CAT 2017”

  1. 在四处挖掘之后,我知道我应该以某种方式使用 DateConverter,但是没有足够的信息来说明如何使用它。

【问题讨论】:

  • 你想绑定哪个 UI 元素?我们通常将日期绑定到选择器。还有什么是异常的完整堆栈跟踪?
  • 谢谢谢。我绑定到一个 TextField,但是当我切换到一个选择器时,一切都按预期工作。

标签: codenameone


【解决方案1】:

现在日期只映射到选择器。我们可能希望增强它以支持带有 SimpleDateFormat 或类似内容的文本字段,但目前不可用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    • 2017-01-20
    • 2017-05-25
    • 2014-01-16
    • 1970-01-01
    • 1970-01-01
    • 2018-08-26
    相关资源
    最近更新 更多