Added a base Model class which implements equals.
This commit is contained in:
parent
a795397b3b
commit
b4ce76063b
@ -1,10 +1,6 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Album {
|
||||
public int id;
|
||||
public class Album extends Model {
|
||||
public String name;
|
||||
public Integer trackTotal;
|
||||
public Integer year;
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Artist {
|
||||
public int id;
|
||||
public class Artist extends Model {
|
||||
public String name;
|
||||
|
||||
public String toString() { return name; }
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Bookmark {
|
||||
public int id;
|
||||
public class Bookmark extends Model {
|
||||
public String name;
|
||||
public int playlistId;
|
||||
public int mediaFileId;
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Image {
|
||||
public int id;
|
||||
public class Image extends Model {
|
||||
public String url;
|
||||
|
||||
public String toString() { return url; }
|
||||
|
@ -2,14 +2,10 @@ package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class MediaFile {
|
||||
public class MediaFile extends Model {
|
||||
public static final String TAG_INFO = "tag info";
|
||||
public static final String FILE_LOCATION = "file location";
|
||||
|
||||
public int id;
|
||||
public String name;
|
||||
public Integer trackNumber;
|
||||
public int playCount = 0;
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Model {
|
||||
public int id;
|
||||
|
||||
public boolean equals(Object thatObj) {
|
||||
if (thatObj == null) return false;
|
||||
if (!(thatObj instanceof Model)) return false;
|
||||
|
||||
Model that = (Model) thatObj;
|
||||
return this.id == that.id; }
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Playlist {
|
||||
public int id;
|
||||
public class Playlist extends Model {
|
||||
public boolean userCreated;
|
||||
public Date lastUsed;
|
||||
public String name;
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Tag {
|
||||
public int id;
|
||||
public class Tag extends Model {
|
||||
public String name;
|
||||
|
||||
public String toString() { return name; }
|
||||
|
Loading…
Reference in New Issue
Block a user