我ClassCastException
在一些类 MarketplaceBasicProductList
和接口IMarketplaceProductList
类之间进行转换时得到了 - 为什么?
public static IMarketplaceProductList createMarketplaceBasicProductList(Table basicInfoTable) {
ArrayList list = new ArrayList();
if (basicInfoTable != null) {
for (int i = 1; i <= basicInfoTable.getRowCount(); i++) {
IMarketplaceBasicProduct product = createMarketplaceBasicProduct(basicInfoTable, i);
list.add(product);
}
}
return (IMarketplaceProductList) new MarketplaceBasicProductList(list);
}
其他细节是:
1.
public interface IMarketplaceProductList extends Serializable {
public int getProductCount();
public IMarketplaceBasicProduct getProductMKPInfo(int index);
}
public class MarketplaceBasicProductList extends AbstractProductList
{ ...................public abstract class AbstractProductList implements IProductList
{ ......
我需要在这里添加还实现 IMarketplaceProductList 吗?
public interface IMarketplaceBasicProduct extends Serializable
{ ...获取 MarketplaceBasicProduct 函数的方法..
5.public class MarketplaceBasicProduct extends BasicProduct implements IMarketplaceBasicProduct, IGenericProductFields {
public class BasicProduct extends AbstractProduct {
7.public abstract class AbstractProduct extends AbstractGenericProduct implements IProduct {
我还需要在这里添加实现IMarketplaceBasicProduct
吗?