package com.wyattjmiller.home.recipefoliobackend.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import java.time.LocalDateTime; import java.util.Objects; @Entity public class Recipe { // properties private @Id @GeneratedValue Long Id; private String Name; private String Description; private String Ingredients; private LocalDateTime CreatedTimestamp = LocalDateTime.now(); // constructors public Recipe() { } public Recipe(String name, String description, String ingredients) { this.Name = name; this.Description = description; this.Ingredients = ingredients; this.CreatedTimestamp = LocalDateTime.now(); } // mehtods (fields) public Long getId() { return this.Id; } public String getName() { return this.Name; } public String getDescription() { return this.Description; } public String getIngredients() { return this.Ingredients; } public String getCreatedTimestamp() { return this.CreatedTimestamp.toString(); } public void setId(Long Id) { this.Id = Id; } public void setName(String Name) { this.Name = Name; } public void setDescription(String Description) { this.Description = Description; } public void setIngredients(String Ingredients) { this.Ingredients = Ingredients; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Recipe)) { return false; } Recipe recipe = (Recipe) o; return Objects.equals(this.Id, recipe.Id) && Objects.equals(this.Name, recipe.Name) && Objects.equals(this.Description, recipe.Description) && Objects.equals(this.Ingredients, recipe.Ingredients) && Objects.equals(this.CreatedTimestamp, recipe.CreatedTimestamp); } @Override public int hashCode() { return Objects.hash(this.Id, this.Name, this.Description, this.Ingredients, this.CreatedTimestamp); } @Override public String toString() { return "Recipe{" + "id=" + this.Id + ", name=" + this.Name + ", description=" + this.Description + ", ingredients=" + this.Ingredients + ", created_timestamp=" + this.CreatedTimestamp + "}"; } }