Skip to content

Instantly share code, notes, and snippets.

@debop
Created July 20, 2013 10:07
Show Gist options
  • Select an option

  • Save debop/6044534 to your computer and use it in GitHub Desktop.

Select an option

Save debop/6044534 to your computer and use it in GitHub Desktop.
Album
@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