2013-02-26 46 views
0

自定义数据类型列表中我创建了一个复合,谁拥有两个方法传递一个复合

  • 公共无效intItem(名单DataList控件)//可以利用原始数据类型
  • 公共无效vipInfoDataList(DataList控件列表)//可以自定义数据类型,如:PlxVipInfo

[注:我定义复合剪切文件夹和进口复合类“PlxVipInfo”数据类型] 然后我做出的复合物,罐子,把我的protlet 。 然后调用这个两种方法:

List<Integer> myCoords = new ArrayList<Integer>(); 
myCoords.add(10); 
myCoords.add(20); 

CommonWidget mycomposite = new CommonWidget(); 
//mycomposite.intItem(myCoords);[**Note: when i call it gives data**] 
mycomposite.vipInfoDataList(vips);[**Note: when i call it gives error**] 

错误是:

compile-java: 
[javac] Compiling 1 source file to /home/bglobal/liferay-sdk/portlets/customer-common-gridview-portlet/docroot/WEB-INF/classes 
[javac] /home/bglobal/liferay-sdk/portlets/customer-common-gridview-portlet/docroot/WEB-INF/src/com/prolexic/portlet/proxy/client/PlxProxyServiceEntryPoint.java:174: vipInfoDataList(java.util.List<com.prolexic.composite.shared.PlxVipInfo>) in com.prolexic.composite.client.CommonWidget cannot be applied to (java.util.List<com.prolexic.portlet.proxy.shared.PlxVipInfo>) 
[javac]      mycomposite.vipInfoDataList(vips); 
[javac]        ^
[javac] Note: /home/bglobal/liferay-sdk/portlets/customer-common-gridview-portlet/docroot/WEB-INF/src/com/prolexic/portlet/proxy/client/PlxProxyServiceEntryPoint.java uses or overrides a deprecated API. 
[javac] Note: Recompile with -Xlint:deprecation for details. 
[javac] 1 error 

现在我应该怎么办?

回答

0

错误清楚地说,自定义类型PlxVipInfo passing through vipInfoDataList() method and the one declared are diffrent

它们是2种不同类别,一种在包装com.prolexic.composite.shared中,另一种在com.prolexic.portlet.proxy.shared中。

所以,在这两个地方,同时使作为参数,并宣布该方法中使用相同类型的任一 com.prolexic.composite.shared.PlxVipInfo或com.prolexic.portlet.proxy.shared.PlxVipInfo像下面代码snippet-

vipInfoDataList(java.util.List<com.prolexic.composite.shared.PlxVipInfo>); 

public void vipInfoDataList(java.util.List<com.prolexic.composite.shared.PlxVipInfo>) 
{ 
} 

OR

vipInfoDataList(java.util.List<com.prolexic.portlet.proxy.shared.PlxVipInfo>); 

public void vipInfoDataList(java.util.List<com.prolexic.portlet.proxy.shared.PlxVipInfo>) 
{ 
}