-
Notifications
You must be signed in to change notification settings - Fork 22
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
Customize MovideEntity Links #23
base: master
Are you sure you want to change the base?
Conversation
Expecting the output of the links object in the jsonapi response inside each movie item to be: links : {self:" ...",rates:" ... ",comments:"..."} but unfortunately it is not working as expected!
|
||
public String getRates() { | ||
|
||
return "https://www.imdb.com/" + getId() + "/rates"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If would do something like:
public String getRates(){
if(rates == null){
return "https://www....";
}
return rates
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this way you have the built-in default, but will also support the setters, e.g. as used by crnk-client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remmeier please check the updates I added the self link also but is there a way so the self link can return the base path also beside the endpoint like before customizing the links
before customizing links
it will return "localhost:8080/movie/{id}"
now I overrided it to return /movie/{id}
1- Added the self link. 2-removed the static type from the movielinks class
@@ -57,5 +60,55 @@ | |||
|
|||
@Version | |||
private Integer version; | |||
|
|||
//This is an example on links customization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use /**... */ for the comment to facilitate multi line comments
@JsonApiLinksInformation | ||
private MovieLinks links = new MovieLinks(); | ||
|
||
public class MovieLinks implements LinksInformation//,SelfLinksInformation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implements SelfLinksInformation would seems right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lombok @DaTa would allow you to get rid of the setters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done if u have any more comments please specify it : ) Thanks!
Add @DaTa annotation on the MovieLinks class
Expecting the output of the links object in the jsonapi response inside each movie item to be:
links : {self:" ...",rates:" ... ",comments:"..."}
but unfortunately it is not working as expected!