spierce7
spierce7

Reputation: 15746

AutoBean Compile Error: "Parameterization is not simple..."

I'm trying to use AutoBean on the server and client to send and receive json data through AppEngines channel API. I don't want to store this data in the datastore. I already have a Proxy for this object that I use for the RequestFactoryServlet (which underneath just uses AutoBean anyways), so this should be doable. Instead of writing up a new Proxy for the object that exactly duplicates the Proxy for the RequestFactoryServlet, I'd like to just use the proxy that I use for the RequestFactoryServlet. The only problem is that I get an error while compiling that comes from my AutoBeanFactory.

Invoking generator com.google.web.bindery.autobean.gwt.rebind.AutoBeanFactoryGenerator [ERROR] The com.wmba.wmbaapp.shared.ObjectProxy parameterization is not simple, but the obj method does not provide a delegate

So I'm not really sure what to do here. It seems like before I added the client side in, it's able to serialize the object into JSON just fine, but for some reason it doesn't like this. It sounds like it wants a delegate from me, but I can't find anything on this from the internet.

Anyone have any ideas?

Note: I also tried the same thing with EntityProxy (which is the base of the RequestFactory framework from what I read on the AutoBean page, but I get the same error).

Upvotes: 0

Views: 1949

Answers (2)

bit
bit

Reputation: 31

It turned out for me that I had a property setter that had an empty parameter list in my Ojbect interface. It didn't have anything to do with the factory, except for the interface the factory was trying to create a proxy for:

interface Factory {
  AutoBeans<MyObject> createObject();
}
interface MyObject {
  String getProperty();
  void setProperty();
}

A bone-headed mistake but held me up with this precise compiler error. Adding the Category annotation as mentioned in the previous answer identified the faulty property setter.

Upvotes: 3

Thomas Broyer
Thomas Broyer

Reputation: 64541

The issue is that EntityProxy defines the stableId method which is not a getter (name doesn't start with get). That makes it a not simple bean, for which AutoBeans require a real bean instance to be wrapped in the created AutoBean (the delegate, passed as an argument of the type of the AutoBeanObjectProxy in your case– to your obj method of the AutoBeanFactory).

In other words, AutoBeans expects your obj method to be of the form:

AutoBean<ObjectProxy> obj(ObjectProxy toWrap);

The simplest solution is to not try to reuse the entity proxy with AutoBeans.


You might be able to make it work though by annotating your AutoBeanFactory with:

@Category(EntityProxyCategory.class)

You might have to add @NoWrap(EntityProxyId.class) too, see http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java

Upvotes: 4

Related Questions