[WIP] Reworked the way the spoonaccular api response gets consumed
- Added pojos for jackson - Filtering unneeded information from spoonaccular response
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package spoonaccular.models.recipe_by_ingredient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import spoonaccular.models.recipe_information.Recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExtendedRecipeByIngredient extends Recipe {
|
||||
|
||||
@JsonProperty("usedIngredientCount")
|
||||
private Integer usedIngredientCount;
|
||||
@JsonProperty("missedIngredientCount")
|
||||
private Integer missedIngredientCount;
|
||||
@JsonProperty("missedIngredients")
|
||||
private List<MissedIngredient> missedIngredients = null;
|
||||
@JsonProperty("usedIngredients")
|
||||
private List<UsedIngredient> usedIngredients = null;
|
||||
|
||||
@JsonProperty("usedIngredientCount")
|
||||
public Integer getUsedIngredientCount() {
|
||||
return usedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredientCount")
|
||||
public void setUsedIngredientCount(Integer usedIngredientCount) {
|
||||
this.usedIngredientCount = usedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredientCount")
|
||||
public Integer getMissedIngredientCount() {
|
||||
return missedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredientCount")
|
||||
public void setMissedIngredientCount(Integer missedIngredientCount) {
|
||||
this.missedIngredientCount = missedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredients")
|
||||
public List<MissedIngredient> getMissedIngredients() {
|
||||
return missedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredients")
|
||||
public void setMissedIngredients(List<MissedIngredient> missedIngredients) {
|
||||
this.missedIngredients = missedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredients")
|
||||
public List<UsedIngredient> getUsedIngredients() {
|
||||
return usedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredients")
|
||||
public void setUsedIngredients(List<UsedIngredient> usedIngredients) {
|
||||
this.usedIngredients = usedIngredients;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
package spoonaccular.models.recipe_by_ingredient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"name"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class MissedIngredient {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@JsonProperty("name")
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
package spoonaccular.models.recipe_by_ingredient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"id",
|
||||
"title",
|
||||
"image",
|
||||
"usedIngredientCount",
|
||||
"missedIngredientCount",
|
||||
"missedIngredients",
|
||||
"usedIngredients",
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class RecipeByIngredient {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Integer id;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("image")
|
||||
private String image;
|
||||
@JsonProperty("usedIngredientCount")
|
||||
private Integer usedIngredientCount;
|
||||
@JsonProperty("missedIngredientCount")
|
||||
private Integer missedIngredientCount;
|
||||
@JsonProperty("missedIngredients")
|
||||
private List<MissedIngredient> missedIngredients = null;
|
||||
@JsonProperty("usedIngredients")
|
||||
private List<UsedIngredient> usedIngredients = null;
|
||||
|
||||
@JsonProperty("id")
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@JsonProperty("id")
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JsonProperty("title")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@JsonProperty("title")
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@JsonProperty("image")
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
@JsonProperty("image")
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredientCount")
|
||||
public Integer getUsedIngredientCount() {
|
||||
return usedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredientCount")
|
||||
public void setUsedIngredientCount(Integer usedIngredientCount) {
|
||||
this.usedIngredientCount = usedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredientCount")
|
||||
public Integer getMissedIngredientCount() {
|
||||
return missedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredientCount")
|
||||
public void setMissedIngredientCount(Integer missedIngredientCount) {
|
||||
this.missedIngredientCount = missedIngredientCount;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredients")
|
||||
public List<MissedIngredient> getMissedIngredients() {
|
||||
return missedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("missedIngredients")
|
||||
public void setMissedIngredients(List<MissedIngredient> missedIngredients) {
|
||||
this.missedIngredients = missedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredients")
|
||||
public List<UsedIngredient> getUsedIngredients() {
|
||||
return usedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("usedIngredients")
|
||||
public void setUsedIngredients(List<UsedIngredient> usedIngredients) {
|
||||
this.usedIngredients = usedIngredients;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
package spoonaccular.models.recipe_by_ingredient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"name"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class UsedIngredient {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@JsonProperty("name")
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
package spoonaccular.models.recipe_information;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"name",
|
||||
"measures"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class ExtendedIngredient {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("measures")
|
||||
private Measures measures;
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@JsonProperty("name")
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@JsonProperty("measures")
|
||||
public Measures getMeasures() {
|
||||
return measures;
|
||||
}
|
||||
|
||||
@JsonProperty("measures")
|
||||
public void setMeasures(Measures measures) {
|
||||
this.measures = measures;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
package spoonaccular.models.recipe_information;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"metric"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class Measures {
|
||||
|
||||
@JsonProperty("metric")
|
||||
private Metric metric;
|
||||
|
||||
@JsonProperty("metric")
|
||||
public Metric getMetric() {
|
||||
return metric;
|
||||
}
|
||||
|
||||
@JsonProperty("metric")
|
||||
public void setMetric(Metric metric) {
|
||||
this.metric = metric;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
package spoonaccular.models.recipe_information;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"amount",
|
||||
"unitShort"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class Metric {
|
||||
|
||||
@JsonProperty("amount")
|
||||
private Double amount;
|
||||
@JsonProperty("unitShort")
|
||||
private String unitShort;
|
||||
|
||||
@JsonProperty("amount")
|
||||
public Double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
@JsonProperty("amount")
|
||||
public void setAmount(Double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@JsonProperty("unitShort")
|
||||
public String getUnitShort() {
|
||||
return unitShort;
|
||||
}
|
||||
|
||||
@JsonProperty("unitShort")
|
||||
public void setUnitShort(String unitShort) {
|
||||
this.unitShort = unitShort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
|
||||
package spoonaccular.models.recipe_information;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({
|
||||
"vegetarian",
|
||||
"vegan",
|
||||
"glutenFree",
|
||||
"dairyFree",
|
||||
"extendedIngredients",
|
||||
"id",
|
||||
"title",
|
||||
"readyInMinutes",
|
||||
"servings",
|
||||
"image",
|
||||
"spoonacularSourceUrl"
|
||||
})
|
||||
@Generated("jsonschema2pojo")
|
||||
public class Recipe {
|
||||
|
||||
@JsonProperty("vegetarian")
|
||||
private Boolean vegetarian;
|
||||
@JsonProperty("vegan")
|
||||
private Boolean vegan;
|
||||
@JsonProperty("glutenFree")
|
||||
private Boolean glutenFree;
|
||||
@JsonProperty("dairyFree")
|
||||
private Boolean diaryFree;
|
||||
@JsonProperty("extendedIngredients")
|
||||
private List<ExtendedIngredient> extendedIngredients = null;
|
||||
@JsonProperty("id")
|
||||
private Integer id;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("readyInMinutes")
|
||||
private Integer readyInMinutes;
|
||||
@JsonProperty("servings")
|
||||
private Integer servings;
|
||||
@JsonProperty("image")
|
||||
private String image;
|
||||
@JsonProperty("spoonacularSourceUrl")
|
||||
private String spoonacularSourceUrl;
|
||||
|
||||
@JsonProperty("vegetarian")
|
||||
public Boolean getVegetarian() {
|
||||
return vegetarian;
|
||||
}
|
||||
|
||||
@JsonProperty("vegetarian")
|
||||
public void setVegetarian(Boolean vegetarian) {
|
||||
this.vegetarian = vegetarian;
|
||||
}
|
||||
|
||||
@JsonProperty("vegan")
|
||||
public Boolean getVegan() {
|
||||
return vegan;
|
||||
}
|
||||
|
||||
@JsonProperty("vegan")
|
||||
public void setVegan(Boolean vegan) {
|
||||
this.vegan = vegan;
|
||||
}
|
||||
|
||||
@JsonProperty("glutenFree")
|
||||
public Boolean getGlutenFree() {
|
||||
return glutenFree;
|
||||
}
|
||||
|
||||
@JsonProperty("glutenFree")
|
||||
public void setGlutenFree(Boolean glutenFree) {
|
||||
this.glutenFree = glutenFree;
|
||||
}
|
||||
|
||||
@JsonProperty("extendedIngredients")
|
||||
public List<ExtendedIngredient> getExtendedIngredients() {
|
||||
return extendedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("extendedIngredients")
|
||||
public void setExtendedIngredients(List<ExtendedIngredient> extendedIngredients) {
|
||||
this.extendedIngredients = extendedIngredients;
|
||||
}
|
||||
|
||||
@JsonProperty("id")
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@JsonProperty("id")
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JsonProperty("title")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@JsonProperty("title")
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@JsonProperty("readyInMinutes")
|
||||
public Integer getReadyInMinutes() {
|
||||
return readyInMinutes;
|
||||
}
|
||||
|
||||
@JsonProperty("readyInMinutes")
|
||||
public void setReadyInMinutes(Integer readyInMinutes) {
|
||||
this.readyInMinutes = readyInMinutes;
|
||||
}
|
||||
|
||||
@JsonProperty("servings")
|
||||
public Integer getServings() {
|
||||
return servings;
|
||||
}
|
||||
|
||||
@JsonProperty("servings")
|
||||
public void setServings(Integer servings) {
|
||||
this.servings = servings;
|
||||
}
|
||||
|
||||
@JsonProperty("image")
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
@JsonProperty("image")
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@JsonProperty("spoonacularSourceUrl")
|
||||
public String getSpoonacularSourceUrl() {
|
||||
return spoonacularSourceUrl;
|
||||
}
|
||||
|
||||
@JsonProperty("spoonacularSourceUrl")
|
||||
public void setSpoonacularSourceUrl(String spoonacularSourceUrl) {
|
||||
this.spoonacularSourceUrl = spoonacularSourceUrl;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user