Support non-default parameter access convention using Java's debug information
- Dominant language
- Java
- Stars
- 400
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
(Email from Guilherme Silveira, [http://java.net/projects/jax-rs-spec/lists/jsr339-experts/archive/2011-03/message/90](http://java.net/projects/jax-rs-spec/lists/jsr339-experts/archive/2011-03/message/90) )
3\. Support to a non-default parameter access convention using Java's debug information. This can be non-default so its up to the user to decide to use it. I surely prefer to be default:
@Resource
public class SoftwareController {
@Get @Path("/software/
{id}")
public Software show(long id) { Software retrieved = dao.search(id); return retrieved; }
}
It can be achieved with backward compatibility by providing the interfaces:
public interface ParameterNameProvider { String[] parameterNamesFor(AccessibleObject methodOrConstructor); }
public interface ParametersProvider { Object[] getParametersFor(ResourceMethod method, List errors, ResourceBundle bundle); // the last two parameters are error related }
This also allows someone to do this, **if he thinks that will boost his productivity**:
@Resource
public class SoftwareController {
@Get @Path("/software/{id}
")
public Software show(Software software)
{ return retrieved; // yep, it was already loaded from the database! }
}
It also allows one to support file upload easily:
@Resource
public class SoftwareController {
@Get @Path("/softwares")
public void upMyBoy(File orAnyOtherRelatedInterfaceOrClass) {
}
}
#### Affected Versions
[2.0]
Contributor guide
Assessment
This issue has not been assessed yet.