Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenProxyProcessor and Lists #201

Closed
kalgon opened this issue Mar 27, 2013 · 8 comments
Closed

GenProxyProcessor and Lists #201

kalgon opened this issue Mar 27, 2013 · 8 comments

Comments

@kalgon
Copy link

kalgon commented Mar 27, 2013

Hi,

I have a problem when I try to generate proxies for entities which have collection members:

@GenProxy(isEmbeddedType = true)
public class Parent {

   @UseProxy(ChildProxy.class)
   private List<Child> children;
}

will generate:

@ProxyFor(Parent.class)
public interface ParentProxy extends ValueProxy {

    ChildProxy getChildren();
}

This is not correct, a List<ChildProxy> should have been used as the return type of getChildren().

@branflake2267
Copy link
Contributor

@christiangoudreau

@branflake2267
Copy link
Contributor

You have a point. That seems strange.

@kalgon
Copy link
Author

kalgon commented Mar 27, 2013

I could work around this limitation by doing this;

@UseProxyName("java.util.List<ChildProxy>")
private List<Child> children;

@bmoritz
Copy link
Contributor

bmoritz commented Apr 18, 2013

I had a look through the JavaDoc of the UseProxy, UseProxyNAme and GenProxy annotations. As far as I can see it's nowhere said, that Collection classes are automatically taken into account when generating proxies. But neither it's said, that they are not considered.
So I'd at least suggest to change the JavaDoc accordingly.
On the other hand it shouldn't be too difficult to change the code and let it generate Collections of Proxies if necessary. But I'm not so sure if this is/was the intended behaviour; additionally it would make the generation process more difficult to understand: sometimes some magic is doing the right thing for you, sometimes it doesn't.
What do you think?

@kalgon
Copy link
Author

kalgon commented Apr 18, 2013

It would be nice if @GenProxy could support all types supported by GWT RequestFactory out-of-the-box (and there aren't that many as you can see at https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory#transportable).

If this can't be automatically detected, maybe something like this would be enough:

public enum AssociationType {
  SINGLE, SET, LIST
}

public @interface UseProxy {
  ...
  AssociationType associationType() default SINGLE;
}

@branflake2267
Copy link
Contributor

Thanks for reporting, I'll look deeper into this.

christiangoudreau added a commit that referenced this issue Jul 4, 2013
Fix issue #201: GenProxyProcessor and Lists (Second try)
@bmoritz
Copy link
Contributor

bmoritz commented Jul 5, 2013

Can we close this issue now, as the PR has been merged?

@olafleur
Copy link
Member

olafleur commented Jul 5, 2013

It is ! ;-)

christiangoudreau pushed a commit that referenced this issue Apr 4, 2014
If a field has a UseProxy annotation and is of type List or Set, then in
the generated Proxy class this field (and its getters and setters) will
also be of type List or Set.
Extending test case for both scenarios; unfortunately it's not possible
to test if the generic type of the List or Set has been generated
correctly.
christiangoudreau added a commit that referenced this issue Apr 4, 2014
Fix issue #201: GenProxyProcessor and Lists (Second try)
hpehl pushed a commit to hpehl/GWTP that referenced this issue Dec 9, 2014
If a field has a UseProxy annotation and is of type List or Set, then in
the generated Proxy class this field (and its getters and setters) will
also be of type List or Set.
Extending test case for both scenarios; unfortunately it's not possible
to test if the generic type of the List or Set has been generated
correctly.


Former-commit-id: 770f013
hpehl pushed a commit to hpehl/GWTP that referenced this issue Dec 9, 2014
Fix issue ArcBees#201: GenProxyProcessor and Lists (Second try)


Former-commit-id: 798a0d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants