IsSerializable Problem (think with args)

3 views
Skip to first unread message

ak.agonia

unread,
Mar 16, 2007, 10:34:21 AM3/16/07
to Google Web Toolkit
hello,please help me.
I use GWT 1.3.3 with JDK 1.5

I'm trying to pass an object from the server side to GWT, so I created
a mockup class 'SelPrestazioni' which only have an Integer for a OD
and another STRING
for Prestazione and getters and setters.

This class SelPrestazioni implements IsSerializable, and it's on my
package
client.server;


<code>
package client.server;

import com.google.gwt.user.client.rpc.IsSerializable;

import rocket.util.client.PrimitiveHelper;
import rocket.util.client.StringHelper;

public class SelPrestazioni implements IsSerializable{

public SelPrestazioni() {

this("","");
}

public SelPrestazioni(String ID,String Prestazione){
setPrestazione(Prestazione);
setId(Integer.parseInt(ID));

}

private String prestazione;

public String getPrestazione() {
StringHelper.checkNotEmpty("field:prestazione", prestazione);
return prestazione;
}

public void setPrestazione(final String prestazione) {
StringHelper.checkNotEmpty("parameter:prestazione",
prestazione);
this.prestazione = prestazione;
}

/**
* The size of the file in bytes.
*/

private int id;

public int getId() {
PrimitiveHelper.checkGreaterThanOrEqual("field:id", id, 0);
return id;
}

public void setId(final int id) {
PrimitiveHelper.checkGreaterThanOrEqual("parameter:id", id,
0);
this.id = id;
}


}

<\code>

i copy this class also in package client.client.


this is my interface
public interface MyService extends RemoteService {

public static final String SERVICE_URI = "/myservice";

/**
*
* Return Value:
* @gwt.typeArgs <client.server.SelPrestazioni>
*
*/

List selPrestazioni();


this is interface MyServiceAsync:
/**
*
* Return Value:
* @gwt.typeArgs <client.server.SelPrestazioni>
*
*/

void selPrestazioni(AsyncCallback callback);

and this is a MYServiceImpl.java

public List selPrestazioni() {
// fare il controllo che se conn == null c'e qualche problema
ResultSet rs= DB_Riciclaggio.sel(conn);
List ar= new ArrayList();

try {
while(rs.next()){
System.out.println(rs.getString(1)+"\t"+rs.getString(2));
ar.add(new SelPrestazioni(rs.getString(1),rs.getString(2)));

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ar;

}

where selPrestazione retunred a LIST that contains object of my class
SelPrestazioni.

The problem is following:
when i run my project i have this problem:

-----1----------
[DEBUG] Type client.client.MyServiceAsync
[TRACE] Method public abstract void
selPrestazioni(com.google.gwt.user.client.rpc.AsyncCallback callback)
[WARN] Unable to recognize 'void<client.server.SelPrestazioni>' as a
type name (is it fully qualified?)
-----------------

------2----------
[DEBUG] Type client.client.MyService
[TRACE] Method public abstract java.util.List selPrestazioni()
[WARN] Unable to recognize
'java.util.List<client.server.SelPrestazioni>' as a type name (is it
fully qualified?)
------------------

------3----------
[DEBUG] Rebinding client.client.MyService
[DEBUG] Examining gwt.typeArgs tags
[TRACE] Method public abstract void
selPrestazioni(com.google.gwt.user.client.rpc.AsyncCallback callback)
[WARN] Unable to recognize 'void<client.server.SelPrestazioni>' as a
type name (is it fully qualified?)
-----------------

-------4--------
[DEBUG] Type client.client.MyService
[TRACE] Method public abstract java.util.List selPrestazioni()
[WARN] Unable to recognize
'java.util.List<client.server.SelPrestazioni>' as a type name (is it
fully qualified?)

--------------------------

any suggestions?? please..

ak.agonia

unread,
Mar 16, 2007, 12:11:21 PM3/16/07
to Google Web Toolkit
I resolve ALL!! myself!!

my correction is :
public SelPrestazioni() {

this("","");
}

replace with:

public SelPrestazioni() {

}

and delete all args. but this not are in guide.

Miguel Méndez

unread,
Mar 19, 2007, 8:14:27 AM3/19/07
to Google-We...@googlegroups.com
Hello ak,

You only need to use the gwt.typeArgs tag on your MyService interface not on your MyServiceAsync interface.

Cheers,

>         StringHelper.checkNotEmpty ("field:prestazione", prestazione);

>         return prestazione;
>     }
>
>     public void setPrestazione(final String prestazione) {
>         StringHelper.checkNotEmpty("parameter:prestazione",
> prestazione);
>         this.prestazione = prestazione;
>     }
>
>     /**
>      * The size of the file in bytes.
>      */
>
>     private int id;
>
>     public int getId() {
>         PrimitiveHelper.checkGreaterThanOrEqual("field:id", id, 0);
>         return id;
>     }
>
>     public void setId(final int id) {
>         PrimitiveHelper.checkGreaterThanOrEqual ("parameter:id", id,
Reply all
Reply to author
Forward
0 new messages