Skip to content

Polish doc #419

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

Closed
wants to merge 1 commit into from
Closed

Polish doc #419

wants to merge 1 commit into from

Conversation

izeye
Copy link
Contributor

@izeye izeye commented Dec 12, 2015

No description provided.

@odrotbohm odrotbohm force-pushed the master branch 2 times, most recently from 4ebc1be to 266ad50 Compare July 25, 2016 18:32
@@ -256,14 +256,14 @@ class PersonResourceAssembler extends ResourceAssemblerSupport<Person, PersonRes
@Override
public PersonResource toResource(Person person) {

PersonResource resource = createResource(person);
PersonResource resource = createResourceWithId(person);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is actually correct. But your other points are valid.

// … do further mapping
return resource;
}
}
----

Setting the class up like this gives you the following benefits: there are a hand full of `createResource(…)` methods that will allow you to create an instance of the resource and have it a `Link` with a rel of `self` added to it. The href of that link is determined by the configured controllers request mapping plus the id of the `Identifiable` (e.g. `/people/1` in our case). The resource type gets instantiated by reflection and expects a no-arg constructor. Simply override `instantiateResource(…)` in case you'd like to use a dedicated constructor or avoid the reflection performance overhead.
Setting the class up like this gives you the following benefits: there are a hand full of `createResourceWithId(…)` methods that will allow you to create an instance of the resource and have it a `Link` with a rel of `self` added to it. The href of that link is determined by the configured controllers request mapping plus the id of the `Identifiable` (e.g. `/people/1` in our case). The resource type gets instantiated by reflection and expects a no-arg constructor. Simply override `instantiateResource(…)` in case you'd like to use a dedicated constructor or avoid the reflection performance overhead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

gregturn pushed a commit that referenced this pull request Mar 14, 2017
@gregturn
Copy link
Contributor

Resolved via 7d9a210

@gregturn gregturn closed this Mar 14, 2017
@izeye izeye deleted the patch-1 branch March 22, 2017 13:46
odrotbohm pushed a commit that referenced this pull request Mar 26, 2017
Fixed references to constants in samples for Link. Also use endsWith(…) matcher in sample tests.
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

Successfully merging this pull request may close these issues.

2 participants