我有一个抽象类PricingProblemSover:
public abstract class PricingProblemSolver<T,U extends Column<T,U>, V extends PricingProblem<T, U>> implements Callable<Void>{ }
一些扩展此解算器的类,例如:
public class ExactPricingProblemSolver extends PricingProblemSolver<CuttingStock, CuttingPattern, CuttingStockPricingProblem> { }
其中CuttingPattern和CuttingStockPricingProblem相同。定义为:
public class CuttingPattern extends Column<CuttingStock, CuttingPattern> {}
public class CuttingStockPricingProblem extends PricingProblem<CuttingStock, CuttingPattern> {}
现在我需要一个solverClasses列表:
List<Class<PricingProblemSolver<CuttingStock, CuttingPattern, CuttingStockPricingProblem>>> solvers=Arrays.asList(ExactPricingProblemSolver.class);
工厂类将使用此列表为每个问题实例生成大量这些求解器的实例。
上面的列表代码给出了以下错误:
Type mismatch: cannot convert from List<Class<ExactPricingProblemSolver>> to List<Class<PricingProblemSolver<CuttingStock,CuttingPattern,CuttingStockPricingProblem>>>
我不确定为什么会出错。有办法解决这个问题吗?