سؤال

I have an AutoBean of type GetGenericQuerySources.

GetGenericQuerySources looks like this:

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 is the interface that I am using. GetGenericQuerySources implements GetGenericQuerySourcesInt and this is what I wrap with the 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);
  ...
}

Currently I initialize and populate the lists as follows:

    GetGenericQuerySourcesInt logicalNamesQryObj = bean.as();

    ...

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

How can I initialize the Lists in GetGenericQuerySources so that I can still use them with AutoBean?

Currently I initialize the lists as new ArrayList<T>() and then populate the ArrayList normally, but when I try to access the list in the AutoBean I get a NPE.

From what I understand this is because of the way AutoBean handles lists (or the lack thereof).

I tried initializing the lists to ArrayList, LinkedList and Vector, but to no avail.

I tried reading up on AutoBean over here, but the documentation is basically non-existent.

It would be much appreciated if someone could point me in the direction of some more in-detail documentation or if you could help me solve my issue.

هل كانت مفيدة؟

المحلول

It's a known issue. You need to wrap the items in the List with their own AutoBean.

See this answer.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top