Hello,
the domain model in my application is represented by Java interfaces.
Therefore, I had the idea to define EntityProxies for interfaces.
For example, domain interface TypeSystem:
public interface TypeSystem {
String getName();
void setName(String name);
}
and EntityProxy:
@ProxyFor(value = TypeSystem.class, locator = TypeSystemLocator.class)
public interface TypeSystemProxy extends EntityProxy {
String getName();
void setName(String name);
}
I created a Locator and a ServiceLocator with a Service, because in
the interface I cannot define static methods or member methods.
I found out that I run into problems (I am using GWT 2.2.0) because
GWT cannot find the proxy type for the entity type.
If I use instead of the interface an abstract class then everything
works fine.
I did some debugging and found the cause of the problem in the method
getEntityProxyTypeName of the class RequestFactoryInterfaceValidator:
/*
* If nothing was found look for proxyable supertypes the domain
object can
* be upcast to.
*/
if (found == null || found.isEmpty()) {
List<Type> types = getSupertypes(parentLogger, key);
for (Type type : types) {
if (objectType.equals(type)) {
break;
}
found = domainToClientType.get(type);
if (found != null && !found.isEmpty()) {
break;
}
}
}
GWT supports in principle the upcast of entity objects. However,
the three lines
if (objectType.equals(type)) {
break;
}
prevent the usage of interfaces. The types list is ordered, it
contains first the super classes, then the objectType, and then the
interfaces.
I removed these three lines, and my example worked.
Is there a reason why GWT does not support EntityProxys for
interfaces?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.