Builder: SavedAlbum
~ SavedAlbum object rewrite for builder implementation
@@ -2,24 +2,47 @@ package com.wrapper.spotify.objects;
import java.util.Date;
-public class SavedAlbum {
+public class SavedAlbum extends AbstractModelObject {
+ private final Date addedAt;
+ private final Album album;
- private Date addedAt;
- private Album album;
+ private SavedAlbum(final SavedAlbum.Builder builder) {
+ super(builder);
- public Date getAddedAt() {
- return addedAt;
+ this.addedAt = builder.addedAt;
+ this.album = builder.album;
}
- public void setAddedAt(Date addedAt) {
- this.addedAt = addedAt;
+ public Date getAddedAt() {
+ return addedAt;
}
public Album getAlbum() {
return album;
}
- public void setAlbum(Album album) {
+ @Override
+ public Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder extends AbstractModelObject.Builder<SavedAlbum.Builder> {
+ private Date addedAt;
+ private Album album;
+
+ public Builder setAddedAt(Date addedAt) {
+ this.addedAt = addedAt;
+ return this;
+ }
+
+ public Builder setAlbum(Album album) {
this.album = album;
+ return this;
+ }
+
+ @Override
+ public SavedAlbum build() {
+ return new SavedAlbum(this);
+ }
}
}
