Created
June 25, 2021 10:49
-
-
Save gabriel-TheCode/7de3323d67c6730fc2faab3e983b6d05 to your computer and use it in GitHub Desktop.
A Java Object Parcelable class
This file contains 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
@Entity(tableName = "favorites") | |
public class Movie implements Parcelable { | |
@Ignore | |
private double popularity; | |
private int vote_count; | |
private boolean video; | |
private String poster_path; | |
private int id; | |
@Ignore | |
private boolean adult; | |
@Ignore | |
private String backdrop_path; | |
@Ignore | |
private String original_language; | |
@Ignore | |
private String original_title; | |
private String title; | |
private double vote_average; | |
private String overview; | |
private String release_date; | |
@Override | |
public void writeToParcel(Parcel dest, int flags) { | |
dest.writeDouble(popularity); | |
dest.writeInt(vote_count); | |
dest.writeByte((byte) (video ? 1 : 0)); | |
dest.writeString(poster_path); | |
dest.writeInt(id); | |
dest.writeByte((byte) (adult ? 1 : 0)); | |
dest.writeString(backdrop_path); | |
dest.writeString(original_language); | |
dest.writeString(original_title); | |
dest.writeString(title); | |
dest.writeDouble(vote_average); | |
dest.writeString(overview); | |
dest.writeString(release_date); | |
} | |
protected Movie(Parcel in) { | |
popularity = in.readDouble(); | |
vote_count = in.readInt(); | |
video = in.readByte() != 0; | |
poster_path = in.readString(); | |
id = in.readInt(); | |
adult = in.readByte() != 0; | |
backdrop_path = in.readString(); | |
original_language = in.readString(); | |
original_title = in.readString(); | |
title = in.readString(); | |
vote_average = in.readDouble(); | |
overview = in.readString(); | |
release_date = in.readString(); | |
} | |
public static final Creator<Movie> CREATOR = new Creator<Movie>() { | |
@Override | |
public Movie createFromParcel(Parcel in) { | |
return new Movie(in); | |
} | |
@Override | |
public Movie[] newArray(int size) { | |
return new Movie[size]; | |
} | |
}; | |
public double getPopularity() { | |
return popularity; | |
} | |
public void setPopularity(double popularity) { | |
this.popularity = popularity; | |
} | |
public int getVote_count() { | |
return vote_count; | |
} | |
public void setVote_count(int vote_count) { | |
this.vote_count = vote_count; | |
} | |
public boolean isVideo() { | |
return video; | |
} | |
public void setVideo(boolean video) { | |
this.video = video; | |
} | |
public String getPoster_path() { | |
return poster_path; | |
} | |
public void setPoster_path(String poster_path) { | |
this.poster_path = poster_path; | |
} | |
public int getId() { | |
return id; | |
} | |
public void setId(int id) { | |
this.id = id; | |
} | |
public boolean isAdult() { | |
return adult; | |
} | |
public void setAdult(boolean adult) { | |
this.adult = adult; | |
} | |
public String getBackdrop_path() { | |
return backdrop_path; | |
} | |
public void setBackdrop_path(String backdrop_path) { | |
this.backdrop_path = backdrop_path; | |
} | |
public String getOriginal_language() { | |
return original_language; | |
} | |
public void setOriginal_language(String original_language) { | |
this.original_language = original_language; | |
} | |
public String getOriginal_title() { | |
return original_title; | |
} | |
public void setOriginal_title(String original_title) { | |
this.original_title = original_title; | |
} | |
public String getTitle() { | |
return title; | |
} | |
public void setTitle(String title) { | |
this.title = title; | |
} | |
public double getVote_average() { | |
return vote_average; | |
} | |
public void setVote_average(double vote_average) { | |
this.vote_average = vote_average; | |
} | |
public String getOverview() { | |
return overview; | |
} | |
public void setOverview(String overview) { | |
this.overview = overview; | |
} | |
public String getRelease_date() { | |
return release_date; | |
} | |
public void setRelease_date(String release_date) { | |
this.release_date = release_date; | |
} | |
@Override | |
public int describeContents() { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment