meals-made-easy-api/src/main/java/app/mealsmadeeasy/api/recipe/star/RecipeStarId.java

53 lines
1.1 KiB
Java

package app.mealsmadeeasy.api.recipe.star;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.util.Objects;
@Embeddable
public class RecipeStarId {
@Column(name = "owner_id", nullable = false)
private Integer ownerId;
@Column(name = "recipe_id", nullable = false)
private Integer recipeId;
public Integer getOwnerId() {
return this.ownerId;
}
public void getOwnerId(Integer ownerId) {
this.ownerId = ownerId;
}
public Integer getRecipeId() {
return this.recipeId;
}
public void setRecipeId(Integer recipeId) {
this.recipeId = recipeId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof RecipeStarId other) {
return this.recipeId.equals(other.recipeId) && this.ownerId.equals(other.ownerId);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(this.recipeId, this.ownerId);
}
@Override
public String toString() {
return "RecipeStarId(" + this.recipeId + ", " + this.ownerId + ")";
}
}