我以为我了解如何使用.class
,Class<>
但我想不是。下面super(ApprovalWorkstation.class
没有被映射到构造函数。我如何确定我正在传递一个类引用,以便基础WorkstationRequest
可以实例化它?
public class ApprovalWorkstation extends Workstation {
public ApprovalWorkstation(WorkstationEntity entity) {
super(entity);
}
}
public class WorkstationRequest extends com.production.socket.request.WorkstationRequest {
public WorkstationRequest() {
super(ApprovalWorkstation.class); //unable to map to constructor
}
}
这是WorkstationRequest
上面扩展的基础
public class WorkstationRequest {
private Class<Workstation> workstationClass;
public void WorkstationRequest(Class<Workstation> workstationClass) {
this.workstationClass = workstationClass;
}
更新
我很抱歉造成混乱,我的构造函数实际上有Class<Workstation>
,而不是Workstation
像我最初那样。