Deferred Binding - Rebind Result must be a class

2,750 views
Skip to first unread message

Alfredo Quiroga-Villamil

unread,
Oct 28, 2011, 3:10:36 PM10/28/11
to google-we...@googlegroups.com

Hello:


I was wondering if someone has ran into the following:


Code:


  ClientFactory clientFactory = GWT.create(ClientFactory.class);

  clientFactory.run();


Web Configuration:

  <replace-with class="com.test.client.ClientFactoryWebImpl">  <!-- Class -->

    <when-type-is class="com.test.client.ClientFactory"/>      <!-- Interface -->

    <when-property-is name="mobilefactor" value="desktop"/>

  </replace-with>


Mobile Configuration:

  <replace-with class="com.test.client.ClientFactoryMobilImpl">  <!-- Class -->

    <when-type-is class="com.test.client.ClientFactory"/>        <!-- Interface -->

    <when-property-is name="mobilefactor" value="mobile"/>

  </replace-with>


Rebind result 'com.test.client.ClientFactory' must be a class


This only happens if I try to compile the application. If I run it in Dev Mode it all works.

Appreciate any feedback.

Regards,

Alfredo

--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton


Thomas Broyer

unread,
Nov 1, 2011, 6:03:47 AM11/1/11
to google-we...@googlegroups.com
What values can "mobilefactor" take?

For instance, the FormFactory module from the mobilewebapp sample defines 3 values: desktop, table, and mobile. You have to define a rebind rule for each one of these values, or set the property to a subset of the values (e.g. <set-property name="formfactor" value="mobile,desktop" />) otherwise the compiler will use the "when-type-is" value (i.e. the interface here) when it cannot find a rule, which would cause the error you're seeing.

Alfredo Quiroga-Villamil

unread,
Nov 1, 2011, 10:23:49 AM11/1/11
to google-we...@googlegroups.com
Hi Thomas, appreciate the response.

I am defining them as follows:

MobileFactor.gwt.xml

<define-property name="mobilefactor" values="desktop,tablet,mobile" />

<collapse-property name="mobilefactor" values="*" />


I have additional lines that are from the mobilewebapp sample you mentioned determining the User Agent and setting it up according to the values shown above (the js part)

In my Application X.gwt.xml I then do an inherit of MobileFactory.gwt.xml and have the lines I sent before for the ClientFactory Implementations with their corresponding conditions. The strange thing that is really throwing me off is that it runs in Dev mode. There it all seems to be ok. However, when I try to compile even when I do it directly from within the IDE that is being used to run it, the exception is thrown. I changed the interface to a regular class and it all works also (compile), but that would defeat the purpose of the ClientFactory implementation at that point. Abstract classes also bark.

I am on GWT 2.1. I've searched and came across some posts but was unable to determine if this is simply user error on my part or it's a bug in the version of GWT I currently have.

Any ideas are really appreciated.

Thanks again,

Alfredo

On Tue, Nov 1, 2011 at 6:03 AM, Thomas Broyer <t.br...@gmail.com> wrote:
What values can "mobilefactor" take?

For instance, the FormFactory module from the mobilewebapp sample defines 3 values: desktop, table, and mobile. You have to define a rebind rule for each one of these values, or set the property to a subset of the values (e.g. <set-property name="formfactor" value="mobile,desktop" />) otherwise the compiler will use the "when-type-is" value (i.e. the interface here) when it cannot find a rule, which would cause the error you're seeing.

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

Alfredo Quiroga-Villamil

unread,
Nov 1, 2011, 10:44:00 AM11/1/11
to google-we...@googlegroups.com
Hi Thomas I was able to find the user error (me in this case). It seems like regardless of the conditions found in the X.gwt.xml I was not accounting for a default case. So I added a third replace-with as a default case and it's all good now. So your previous answer def. pointed me in the right direction.

Thanks again for the response. It's really appreciated.

Alfredo

Thomas Broyer

unread,
Nov 1, 2011, 10:56:04 AM11/1/11
to google-we...@googlegroups.com
FYI, it's not about a "default case", it's because you didn't have a rebind rule for the case where mobilefactor=tablet (which the "default case" now accounts for). It worked in DevMode because you then running with mobilefactor=desktop, which had a rebind rule.

Alfredo Quiroga-Villamil

unread,
Nov 1, 2011, 11:22:22 AM11/1/11
to google-we...@googlegroups.com
Ah makes sense, even better. 

Thanks again man, appreciate it.

Alfredo

On Tue, Nov 1, 2011 at 10:56 AM, Thomas Broyer <t.br...@gmail.com> wrote:
FYI, it's not about a "default case", it's because you didn't have a rebind rule for the case where mobilefactor=tablet (which the "default case" now accounts for). It worked in DevMode because you then running with mobilefactor=desktop, which had a rebind rule.

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reply all
Reply to author
Forward
0 new messages