【问题标题】:Using lists with AutoBean在 AutoBean 中使用列表
【发布时间】:2013-05-10 12:53:47
【问题描述】:

我有一个AutoBean 类型为GetGenericQuerySources

GetGenericQuerySources 如下所示:

public class GetGenericQuerySources implements Serializable,
    GetGenericQuerySourcesInt {
  /**
   * 
   */
  private static final long serialVersionUID = 1L;

  public boolean queriesIsCurrent;

  public String seUId;

  // Sources
  public int fLsId;
  public String where;
  public List<Integer> filterBLnId;
  public List<List<String>> filterValues;
  public List<String> operators;
  ...
}

GetGenericQuerySourcesInt 是我正在使用的接口。 GetGenericQuerySources 实现 GetGenericQuerySourcesInt 这就是我用 AutoBean 包装的。

public interface GetGenericQuerySourcesInt {

  public boolean isQueriesIsCurrent();

  public void setQueriesIsCurrent(boolean queriesIsCurrent);

  public String getSeUId();

  public void setSeUId(String seUId);

  public int getfLsId();

  public void setfLsId(int fLsId);
  ...
}

目前我初始化并填充列表如下:

    GetGenericQuerySourcesInt logicalNamesQryObj = bean.as();

    ...

    logicalNamesQryObj.setQueriesIsCurrent(queriesIsCurrent);
    logicalNamesQryObj.setQueryId(currentQuery.getQId());
    logicalNamesQryObj.setParameterNames(new ArrayList<String>());
    logicalNamesQryObj.setParameterValues(new ArrayList<String>());

如何初始化GetGenericQuerySources 中的列表,以便我仍然可以将它们与AutoBean 一起使用?

目前我将列表初始化为new ArrayList&lt;T&gt;(),然后正常填充ArrayList,但是当我尝试访问AutoBean 中的列表时,我得到了一个N​​PE。

据我了解,这是因为 AutoBean 处理列表的方式(或缺少列表)。

我尝试将列表初始化为ArrayListLinkedListVector,但无济于事。

我尝试阅读AutoBean 而不是here,但文档基本上不存在。

如果有人能指出一些更详细的文档的方向,或者你能帮助我解决我的问题,我将不胜感激。

【问题讨论】:

  • 什么是 MyObjectInterface - 您使用的是 actual autobean 接口吗?你是如何初始化这些列表的?
  • @ColinAlworth 请看我的编辑。

标签: list gwt autobean


【解决方案1】:

这是一个已知问题。您需要使用它们自己的 AutoBean 将 List 中的项目包装起来。

this answer

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多