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

Make possible generating client proxy from implementation class #8

Open
alexcom opened this issue May 21, 2019 · 0 comments
Open

Make possible generating client proxy from implementation class #8

alexcom opened this issue May 21, 2019 · 0 comments

Comments

@alexcom
Copy link

alexcom commented May 21, 2019

I tried to use JSON-RPC client today using proxy generation.
CommandService commandService = rpc.onDemand(CommandService.class);
But I didn't have separate interface declaration, just service class with JSON-RPC annotations. I decided to try this class directly and got this error:

java.lang.IllegalStateException: Method 'wait' is not annotated as @JsonRpcMethod
at com.github.arteam.simplejsonrpc.client.builder.Reflections.getClassMetadata(Reflections.java:57)
at com.github.arteam.simplejsonrpc.client.builder.ObjectApiBuilder.<init>(ObjectApiBuilder.java:53)
at com.github.arteam.simplejsonrpc.client.JsonRpcClient.onDemand(JsonRpcClient.java:96)
...

Then I tried to extract interface with annotations and leave implementation class without annotations. I got Method not found error. Meta-information wasn't read from interface declaration.
Basically if I want to use proxy client generation I have to have my interface annotated and if I want framework to recognize implementation class' methods I need to keep annotations in place there. It means that JSON-RPC metadata is duplicated across interface and implementation.

It would be nice to be able to generate client proxy directly from annotated class, not just interface. Generator would search for annotated methods only and ignore all others.
What you think?

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

1 participant