Skip to content

"Get Link functionality" of ResourceSupport class #542

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
6pet6ter6 opened this issue Feb 28, 2017 · 1 comment
Closed

"Get Link functionality" of ResourceSupport class #542

6pet6ter6 opened this issue Feb 28, 2017 · 1 comment
Assignees
Milestone

Comments

@6pet6ter6
Copy link

6pet6ter6 commented Feb 28, 2017

Links in a ResourceSupport class are stored in an ArrayList, this makes it possible to hold several links with the same 'rel' with different hrefs. If I call the method getLink(rel), only the first matching entry is returned.

public Link getLink(String rel) {

		for (Link link : links) {
			if (link.getRel().equals(rel)) {
				return link;
			}
		}

		return null;
	}

On client side the produced JSON looks like a multi valued map with one or more entries for one rel.
Wouldn't it be better to use such a map in the ResourceSupport class itself to keep consistency?

@gregturn
Copy link
Contributor

Since Link and ResourceSupport are mediatype neutral containers, there is no need to force them to store things in relation to one mediatype (HAL in this case).

However, the desire to retrieve ALL links related to a given rel makes sense, given RFC5988 supports this.

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
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
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 gregturn self-assigned this Mar 26, 2017
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 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

2 participants