You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Adrian Cole <no...@github.com> on 2014/11/10 05:35:02 UTC
[jclouds] Implicitly create a json response parser when using
@Transform (#597)
Before this change, in order to use a `@Transform` annotation, you would have to create a boiler-plate response parser for json methods. Ex.
```java
@GET
@ResponseParser(AddressPage.class)
@Transform(AddressPages.class)
Iterator<ListPage<Address>> list();
static final class AddressPage extends ParseJson<ListPage<Address>> {
@Inject AddressPage(Json json) {
super(json, new TypeLiteral<ListPage<Address>>() {
});
}
}
```
This completely clutters the experience, as this can be easily taken care of. With this change, the above code is shortened, as it doesn't require you to declare the intermediate type.
```java
@GET
@Transform(AddressPages.class)
Iterator<ListPage<Address>> list();
```
You can merge this Pull Request by running:
git pull https://github.com/adriancole/jclouds adrian.transformer-implicit-json-parser
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull/597
-- Commit Summary --
* Implicitly create a json response parser when using @Transform.
-- File Changes --
M core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java (81)
M core/src/test/java/org/jclouds/rest/internal/InvokeHttpMethodTest.java (13)
M core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java (281)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/597.patch
https://github.com/jclouds/jclouds/pull/597.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1896](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1896/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62346342
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1897](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1897/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62349735
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1371](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1371/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62342822
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1369](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1369/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62342059
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Andrew Phillips <no...@github.com>.
> Basically, if someone made a boiler-plate `@ResponseParser` which just parses json into the input
> type of the `@Transform` function, they can now remove the `@ResponseParser` annotation and the
> boilerplate class.
Cool. +1, looks good to me in that case!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62415715
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Adrian Cole <no...@github.com>.
This doesn't affect existing use of `@ResponseParser`, `@SelectJson`
etc. This change only makes `@ResponseParser`optional. So, this
affects new code or existing code people want to clean up.
Basically, if someone made a boiler-plate `@ResponseParser` which just
parses json into the input type of the `@Transform` function, they can
now remove the `@ResponseParser` annotation and the boilerplate class.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62398923
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #280](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/280/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62341105
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1370](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1370/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62342491
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1895](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1895/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62343191
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #282](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/282/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62342457
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Adrian Cole <no...@github.com>.
cc @jdaggett @zack-shoylev @nacx @andreaturli @ccustine @demobox
I'm sorry for not having done this earlier...
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62340377
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #281](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/281/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62342131
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Adrian Cole <no...@github.com>.
Tested temporarily on GCE. Will port the whole provider to use this after merge.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62340450
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Adrian Cole <no...@github.com>.
Paid for most new lines with cleanups of old ones.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62341210
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Adrian Cole <no...@github.com>.
using commit-then-review on this as it is obviously a move forward, but happy to address nits later.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62394915
Re: [jclouds] Implicitly create a json response parser when using
@Transform (#597)
Posted by Andrew Phillips <no...@github.com>.
Just to make sure I understand: what would happen now if a user (legacy) code has both `@Transform` and a `@ResponseParser`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/597#issuecomment-62394605