Thursday, May 19, 2016

How to sort a list of objects from the shared folder on server-side?

Hello,

I want to use Collections.sort() on a List<MyClass>. To do this, I have implemented Comparable<MyClass> in MyClass.
However, I need to access the database within the compareTo-method

class MyClass implements IsSerializable,Comparable<MyClass>
{
...
 public int compareTo(MyClass tgt)
 {
 
Database d = new Database();
 d
.loadSomething();
...
 }
}


When I run this, I get "No source code is available for type Database. This is because Database is a server-side class while MyClass is in the shared folder.

Is it possible to move the compareTo-code to server-side somehow and still use Collections.sort?
If not, how would you solve this?

Thanks
Magnus

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment