This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues or pull requests.

87 lines
2.2 KiB
Java
Raw Normal View History

2022-08-06 19:09:20 -04:00
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;
2022-08-07 16:00:49 -04:00
private LocalDateTime CreatedTimestamp = LocalDateTime.now();
2022-08-06 19:09:20 -04:00
// constructors
public Recipe() {
}
2022-08-07 16:00:49 -04:00
public Recipe(String name, String description, String ingredients) {
2022-08-06 19:09:20 -04:00
this.Name = name;
this.Description = description;
this.Ingredients = ingredients;
2022-08-07 16:00:49 -04:00
this.CreatedTimestamp = LocalDateTime.now();
2022-08-06 19:09:20 -04:00
}
// 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 + "}";
}
}