私はこの2つのクラスを持っています。私は、親クラスから子クラスのfildsで初期化する必要があります。Java Genericsの構文設定ツール
public class A {
protected LazyFacade<E> list;
protected LazyDataModel<E> model;
protected MyObject myObject;
protected LazyDataModel<E> buildModel() {
lazyModel = new LazyDataModel<E>() {
public List<E> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
List<E> resultList = null;
try {
setRowCount((int) list.countObjects(myObject, filters));
resultList = list.listObject(myObject, first, pageSize, sortField, sortOrder, filters);
} catch (PersistenceException e) {
}
return resultList;
}
};
return lazyModel;
}
//getters setters
}
public class B extends A {
public B() {
this.list = new LazyFacade<OtherClass>(); **//is it correct way to instantiate the list???**
this.myObject = getObjectInDataBase();
this.model = buildModel(); **//the model must have the same class of LazyFacade, in this case OtherClass.
//How could i do it?**
}
}
に
public class A {
を変更してみてください? 「E」は何だと思いますか? – SLaks