Skip to content

Consistent handling of multiple Links with same rel #157

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
chrylis opened this issue Feb 26, 2014 · 3 comments
Closed

Consistent handling of multiple Links with same rel #157

chrylis opened this issue Feb 26, 2014 · 3 comments
Assignees
Milestone

Comments

@chrylis
Copy link

chrylis commented Feb 26, 2014

The current Link handling in ResourceSupport uses a List as its store and will add a new Link regardless of whether one with the specified relation is already present. However, the hasLink and getLink methods traverse the list and stop at the first match. This makes sense for hasLink, but there's a semantic inconsistency with getLink: either ResourceSupport should only permit a single Link per relation type (maybe converting to a Map internally; getLinks should probably be generalized to Collection anyway), or the getter should return all links matching the specified relation, perhaps with a specialized getSingleLink.

(This issue cropped up because I'm trying to model an artwork/artist scenario where the artist relation should be directly embedded on the artwork resource, not redirected through a collection resource, but some works need multiple artists.)

@waldemar-schneider
Copy link

I see this also as a usefull method of the Link class. +1

@gregturn
Copy link
Contributor

Related to #542

gregturn added a commit that referenced this issue Mar 26, 2017
Introduces `ResourceSupport.getLinks(String rel)` to allow returning ALL links related to a give rel.

Resolves #542,#318,#319,#157
gregturn added a commit that referenced this issue Mar 26, 2017
Introduces `ResourceSupport.getLinks(String rel)` to allow returning ALL links related to a give rel.

Resolves #542,#318,#319,#157
@gregturn
Copy link
Contributor

Resolved via 0e8b0e1

@gregturn gregturn self-assigned this Mar 26, 2017
@gregturn gregturn added this to the 0.24 milestone Mar 26, 2017
odrotbohm pushed a commit that referenced this issue Mar 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants