Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created June 23, 2017 16:19
Show Gist options
  • Save NezSpencer/92e59f00d9062b6b94034b645cb77ea2 to your computer and use it in GitHub Desktop.
Save NezSpencer/92e59f00d9062b6b94034b645cb77ea2 to your computer and use it in GitHub Desktop.
Pojo class for baking app
package com.nezspencer.bakingapp.pojo;
import android.os.Parcel;
import android.os.Parcelable;
public class BakingRecipe implements Parcelable {
public static final Creator<BakingRecipe> CREATOR = new Creator<BakingRecipe>() {
@Override
public BakingRecipe createFromParcel(Parcel source) {
BakingRecipe var = new BakingRecipe();
var.image = source.readString();
var.servings = source.readInt();
var.name = source.readString();
var.ingredients = source.createTypedArray(BakingRecipeIngredients.CREATOR);
var.id = source.readInt();
var.steps = source.createTypedArray(BakingRecipeSteps.CREATOR);
return var;
}
@Override
public BakingRecipe[] newArray(int size) {
return new BakingRecipe[size];
}
};
private String image;
private int servings;
private String name;
private BakingRecipeIngredients[] ingredients;
private int id;
private BakingRecipeSteps[] steps;
public String getImage() {
return this.image;
}
public void setImage(String image) {
this.image = image;
}
public int getServings() {
return this.servings;
}
public void setServings(int servings) {
this.servings = servings;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public BakingRecipeIngredients[] getIngredients() {
return this.ingredients;
}
public void setIngredients(BakingRecipeIngredients[] ingredients) {
this.ingredients = ingredients;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public BakingRecipeSteps[] getSteps() {
return this.steps;
}
public void setSteps(BakingRecipeSteps[] steps) {
this.steps = steps;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.image);
dest.writeInt(this.servings);
dest.writeString(this.name);
dest.writeTypedArray(this.ingredients, flags);
dest.writeInt(this.id);
dest.writeTypedArray(this.steps, flags);
}
@Override
public int describeContents() {
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment