Jsf Primefaces LazyLoading java类没有字段

Jsf Primefaces LazyLoading java类没有字段,jsf,primefaces,Jsf,Primefaces,我对这个物体有一种奇怪的情况 contract 在方法中 load 似乎没有字段为什么 public class LazyContractDataModel extends LazyDataModel<Contract>{ /** * */ private static final long serialVersionUID = -9001840760481920608L; private List<Contract> datasource;

我对这个物体有一种奇怪的情况

  contract 
在方法中

  load 
似乎没有字段为什么

public class LazyContractDataModel extends LazyDataModel<Contract>{


/**
 * 
 */
private static final long serialVersionUID = -9001840760481920608L;
private List<Contract> datasource;

public LazyContractDataModel(List<Contract> datasource) {
    this.datasource = datasource;
}

@Override
public Contract getRowData(String rowKey) {
    for(Contract Contract : datasource) {
        if(Contract.getUniqueRowID().equals(rowKey))
            return Contract;
    }

    return null;
}

@Override
public Object getRowKey(Contract Contract) {
    return Contract.getUniqueRowID();
}

@Override
public List<Contract> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters) {

    System.out.println("load Data");
    List<Contract> data = new ArrayList<Contract>();

    //filter
    for(Contract contract : datasource) {
        boolean match = true;

        for(Iterator<String> it = filters.keySet().iterator(); it.hasNext();) {
            try {
                System.out.println("filters");

                String filterProperty = it.next();
                System.out.println("filterProperty: " + filterProperty);

                String filterValue = filters.get(filterProperty);
                System.out.println("filterValue: " + filterValue);

                System.out.println("load: " + contract.getUniqueRowID());
                System.out.println(contract.getClass().getFields()[0].getName());
                System.out.println(contract.getClass().getField(filterProperty).getName());

                String fieldValue = String.valueOf(contract.getClass().getField(filterProperty).get(contract));
                System.out.println("fieldValue: " + fieldValue);

                if(filterValue == null || fieldValue.startsWith(filterValue)) {
                    match = true;
                }
                else {
                    match = false;
                    break;
                }
            } catch(Exception e) {
                System.out.println("filters exception");

                System.out.println(e);
                match = false;
            } 
        }
        System.out.println(match);
        if(match) {
            data.add(contract);
        }
    }

    //sort

    if(sortField != null) {
        Collections.sort(data, new LazySorter(sortField, sortOrder));
    }


    //rowCount
    int dataSize = data.size();
    this.setRowCount(dataSize);

    //paginate
    if(dataSize > pageSize) {
        try {
            return data.subList(first, first + pageSize);
        }
        catch(IndexOutOfBoundsException e) {
            return data.subList(first, first + (dataSize % pageSize));
        }
    }
    else {
        return data;
    }
}
}
打印正确的值

但是

给我:

    ArrayoutofboundExpcetion 
这意味着没有字段

   public class Contract implements Serializable

好的,我得到合同中的字段是私有的,所以按照我的编码方式,我无法访问它们


已解决

OMG,因为它们是私有字段!!!!
    ArrayoutofboundExpcetion 
   public class Contract implements Serializable