chore(commons/logging): descriptive toString for models

This commit is contained in:
Zhongheng Liu 2026-01-08 16:33:08 +01:00
commit 841fe75fad
Signed by: steven
GPG key ID: F69B980899C1C09D
2 changed files with 12 additions and 6 deletions

View file

@ -103,6 +103,14 @@ public class Ingredient {
public int hashCode() { public int hashCode() {
return Objects.hash(id, name, proteinPer100g, fatPer100g, carbsPer100g); return Objects.hash(id, name, proteinPer100g, fatPer100g, carbsPer100g);
} }
@Override
public String toString() {
return "Ingredient " + id + " - " + name +
"= P:" + proteinPer100g +
"/F:" + fatPer100g +
"/C:" + carbsPer100g + " per 100g";
}
} }

View file

@ -157,12 +157,10 @@ public class Recipe {
@Override @Override
public String toString() { public String toString() {
return "Recipe{" + return "Recipe " + id +
"id=" + id + " - " + name +
", name='" + name + '\'' + ": " + ingredients.size() + " ingredients / " +
", ingredientsCount=" + ingredients.size() + preparationSteps.size() + " steps";
", preparationStepsCount=" + preparationSteps.size() +
"}";
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")