与参数化接口不兼容的类型

时间:2014-02-06 15:46:18

标签: java gwt

尝试在这样的示例中实现参数化:

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

参数化的东西我做错了什么?

由于

0 个答案:

没有答案