Created
July 20, 2013 10:07
-
-
Save debop/6044534 to your computer and use it in GitHub Desktop.
Album
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Document | |
| @Getter | |
| @Setter | |
| public class Album extends ValueObjectBase { | |
| @Id | |
| private ObjectId id; | |
| private String title; | |
| private String artist; | |
| private List<Track> tracks = new ArrayList<Track>(); | |
| public Album(String title, String artist) { | |
| Guard.shouldNotBeEmpty(title, "title"); | |
| Guard.shouldNotBeEmpty(artist, "artist"); | |
| this.title = title; | |
| this.artist = artist; | |
| } | |
| public void add(Track tract) { | |
| this.tracks.add(tract); | |
| } | |
| @Override | |
| public int hashCode() { | |
| return HashTool.compute(id); | |
| } | |
| @Override | |
| public Objects.ToStringHelper buildStringHelper() { | |
| return super.buildStringHelper() | |
| .add("id", id) | |
| .add("title", title) | |
| .add("artist", artist); | |
| } | |
| private static final long serialVersionUID = 958798390838794475L; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment