Upgraded to Spring 3.2.3 to be able to use inlined CGLib directly. We now use Objenesis to create the proxy instances which avoids the need for a default constructor.
ControllerLinkBuilder(Factory) now has a linkTo(Method method, Object… parameters) and linkTo(Object dummyMethodInvocationResult) method to either inspect the given method or the result of the dummy method invocation that can be created through DummyInvocationUtils.methodOn(…). So for the following controller:
@Controller
@RequestMapping("/people")
class PersonController {
@RequestMapping(value = "/{person}", method = RequestMethod.GET)
public HttpEntity<PersonResource> show(@PathVariable Long person) { … }
}
you could now do:
Link link = linkTo(methodOn(PersonController.class).show(2L)).withSelfRel();
assertThat(link.getHref(), is("/people/2")));
The code is highly inspired by the code Dietrich Schulten (@dschulten) provided in his pull requests but radically reduced to the core functionality. I also didn't add support for JAX-RS in the first place, but this is definitely a topic going forward.
LinkDiscoverer exposes an API to find Links by their relation types in representations. Added JSONPath based base class and a DefaultLinkDiscoverer that finds Links based on the default rendering of our Jackson mappings.
Added Jackson 2 dependencies. Doubly annotated representation model classes with both Jackson 1 and Jackson 2 annotations. Added Integration tests for Jackson 2 marshaling provided by Jon. Polished template.mf.
Introduced Resource and Resources value objects. The former captures single entity instances but adds links to it. The latter does the same for a collection of entities. Added SPI interfaces ResourcePostProcessor and ResourcesPostProcessor to allow manipulating Resource and Resources instances.
Set version number to 0.1.0.BUILD-SNAPSHOT to quickly allow releases while not doing an 1.0.0 release in the first place. Added Bundlor to generate an appropriate OSGi manifest.