Saturday, September 1, 2012

gwt rpc generics java.lang.Class

Hi to all,

i am facing a problem with the java generics in rpc. I have implemented a rpc service using the java.lang.class<T> generic and while it works fine when i test it, it cannot be compiled. I have serialized the class that i need to pass through the rpc and i have implemented the default empty constructor but it still does not compile.

Here is my service and the class that i need to pass through the generic.

package com.client.model.mybay.browse;



import java.util.ArrayList;


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

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

import com.shared.source.MySource;


@RemoteServiceRelativePath("categoryService")

public interface CategoryBrowseService extends RemoteService{


ArrayList<MySource> getSourceList(Class<? extends MySource> classType);

}




package com.client.model.mybay.browse;


import java.util.ArrayList;


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

import com.shared.source.MySource;


public interface CategoryBrowseServiceAsync {


void getSourceList(Class<? extends MySource> classType,

AsyncCallback<ArrayList<MySource>> callback);


}




package com.sourcebay.shared.source;


import java.util.Date;


import javax.jdo.annotations.IdGeneratorStrategy;

import javax.jdo.annotations.Inheritance;

import javax.jdo.annotations.InheritanceStrategy;

import javax.jdo.annotations.PersistenceCapable;

import javax.jdo.annotations.Persistent;

import javax.jdo.annotations.PrimaryKey;


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



@PersistenceCapable

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)

public abstract class MySource implements IsSerializable {


@PrimaryKey

@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

private Long id;

@Persistent

private String userId;

@Persistent

private String title;

@Persistent

private String description;

@Persistent

private String blobKey;

@Persistent

private String youtubeLink;

@Persistent

private String personalLink;

@Persistent

private Date submitedDate;

@Persistent

private float price;


public MySource() {

}

public float getPrice() {

return price;

}


public void setPrice(float price) {

this.price = price;

}


public String getUserId() {

return userId;

}


public void setUserId(String userId) {

this.userId = userId;

}


public String getTitle() {

return title;

}


public void setTitle(String title) {

this.title = title;

}


public String getDescription() {

return description;

}


public void setDescription(String description) {

this.description = description;

}


public String getBlobKey() {

return blobKey;

}


public void setBlobKey(String blobKey) {

this.blobKey = blobKey;

}


public String getYoutubeLink() {

return youtubeLink;

}


public void setYoutubeLink(String youtubeLink) {

this.youtubeLink = youtubeLink;

}


public String getPersonalLink() {

return personalLink;

}


public void setPersonalLink(String personalLink) {

this.personalLink = personalLink;

}


public Date getSubmitedDate() {

return submitedDate;

}


public void setSubmitedDate(Date submitedDate) {

this.submitedDate = submitedDate;

}


public Long getId() {

return id;

}

}



I am using AppEngine 1.7.1 and GWT 2.4.0. Does anybody have any idea how to fix this?


Thanks in advance,


Ste

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment