4. Updating models
3m

🎯 Your goal for this step:

Update the MappedTrack model with a property that identifies its primary artist

Updating model tasks

Solution: Updating models

models/MappedTrack
public class MappedTrack extends Track {
// ...other MappedTrack methods
private String artistId;
@JsonSetter("track")
public void setTrackProperties(JsonNode trackObject) {
// other setter method calls
this.setArtistId(trackObject.get("artists").get(0).get("id").asText());
}
public void setArtistId(String artistId) {
this.artistId = artistId;
}
public String getArtistId() {
return this.artistId;
}
}
Previous

Share your questions and comments about this lesson

Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.