Thursday, July 28, 2011

Re: Error Polymorphic RequestContext GWT 2.4 RC

Thanks man!
I thought that I could generalize in such a way that didn't need to create a RequestContext for each entityProxy.
Force of habit that I always have to try generalize it up.

Follows my code up and working properly now:

public class Main implements EntryPoint {
    final private EventBus eventBus = new SimpleEventBus();
    private BaseEntityRF rf         = GWT.create(BaseEntityRF.class);
   
    @Override
    public void onModuleLoad() {
        rf.initialize(eventBus);
   
        CountryRequest reqCountry = rf.countryRequest();
        CountryProxy country      = reqCountry.create(CountryProxy.class);
        country.setCode("FR");
        country.setName("France");
    }
}

@ProxyFor(value = Country.class, locator = BaseEntityLocator.class)
public interface CountryProxy extends BaseEntityProxy {
    String getCode();
    String getName();

    void setCode(String code);
    void setName(String name);
}

@Service(value = DAOJPA10.class, locator = DaoServiceLocator.class)

public interface BaseEntityRequest<T extends BaseProxy> extends RequestContext {
    Request<Void> insert(T instance);
    Request<T> update(T instance);
    Request<Void> delete(T instance);
}

@Service(value = DAOJPA10.class, locator = DaoServiceLocator.class)
public interface CountryRequest extends BaseEntityRequest<CountryProxy> {}

public interface BaseEntityRF extends RequestFactory {
    CountryRequest countryRequest();
}

--
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/-/XRu4q33KYbAJ.
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