尝试在这样的示例中实现参数化:
import com.google.gwt.core.client.GWT;
import name.pehl.piriti.xml.client.XmlReader;
import name.pehl.piriti.xml.client.XmlWriter;
public interface XmlPiritiService<T>
{
public interface Reader extends XmlReader<T>
{
}
public interface Writer extends XmlWriter<T>
{
}
public static final Reader READER = GWT.create(Reader.class);
public static final Writer WRITER = GWT.create(Writer.class);
}
import gwt.client.common.client.pirity.XmlPiritiService;
import name.pehl.piriti.commons.client.Path;
public class ResultsModel implements XmlPiritiService<ResultsModel>
{
@Path("TotalCount")
private int totalCount;
public int getTotalCount()
{
return totalCount;
}
public void setTotalCount(int totalCount)
{
this.totalCount = totalCount;
}
}
然后我尝试从静态变量使用XmlReader的方法read(): ResultsModel resultsModel = ResultsModel.READER.read(response.getText());
有一种不兼容的类型。 必需:ResultsModel 发现:T
参数化的东西我做错了什么?
由于