Search code examples
gwtliferaycomposite

pass a custom data type list in a composite


I created a composite, who has two method

  • public void intItem(List dataList) //can take primitive data type
  • public void vipInfoDataList(List dataList) // can take custom data type like: PlxVipInfo

[note: i define "PlxVipInfo" data type in composite sheared folder and import in composite class] then i make the composite as jar and put in my protlet. then call this two method:

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**] 

error is :

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

Now what should i do?


Solution

  • ERROR clearly says, the custom type PlxVipInfo passing through vipInfoDataList() method and the one declared are diffrent.

    They are 2 diffrent classes, one in the package com.prolexic.composite.shared and another in com.prolexic.portlet.proxy.shared.

    So, in both places while passing as an argument and declaring the method use same type either com.prolexic.composite.shared.PlxVipInfo or com.prolexic.portlet.proxy.shared.PlxVipInfo like below code 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>)
    {
    }