This will permit the following to work:
```java
abstract class Resource {
abstract String id();
abstract String type();
@Inject static Resource create(@Named("id") String id,
@Named("type") type) {
return new AutoValue_Resource(id, type);
}
}
```
Note that if we like, we could make a shorthand for naming parameters similar
to ConstructorProperties
ex. `@ParameterNames({"id", "type"})`
https://issues.apache.org/jira/browse/JCLOUDS-750
You can merge this Pull Request by running:
git pull https://github.com/adriancole/jclouds adrian.json-factory-method
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull/586
-- Commit Summary --
* JCLOUDS-750 Allow abstract value types to be constructed from json using
static factory methods.
-- File Changes --
M core/src/main/java/org/jclouds/reflect/Reflection2.java (29)
M
core/src/test/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactoryTest.java
(54)
M core/src/test/java/org/jclouds/reflect/Reflection2Test.java (19)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/586.patch
https://github.com/jclouds/jclouds/pull/586.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/586