Repository navigation
Expand file tree
/
Copy pathMealTo.java
More file actions
69 lines (55 loc) · 1.8 KB
/
Copy pathMealTo.java
File metadata and controls
69 lines (55 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package ru.javawebinar.topjava.to;
import java.beans.ConstructorProperties;
import java.time.LocalDateTime;
import java.util.Objects;
public class MealTo extends BaseTo {
private final LocalDateTime dateTime;
private final String description;
private final int calories;
private final boolean excess;
@ConstructorProperties({"id", "dateTime", "description", "calories", "excess"})
public MealTo(Integer id, LocalDateTime dateTime, String description, int calories, boolean excess) {
super(id);
this.dateTime = dateTime;
this.description = description;
this.calories = calories;
this.excess = excess;
}
public LocalDateTime getDateTime() {
return dateTime;
}
public String getDescription() {
return description;
}
public int getCalories() {
return calories;
}
public boolean isExcess() {
return excess;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MealTo mealTo = (MealTo) o;
return calories == mealTo.calories &&
excess == mealTo.excess &&
Objects.equals(id, mealTo.id) &&
Objects.equals(dateTime, mealTo.dateTime) &&
Objects.equals(description, mealTo.description);
}
@Override
public int hashCode() {
return Objects.hash(id, dateTime, description, calories, excess);
}
@Override
public String toString() {
return "MealTo{" +
"id=" + id +
", dateTime=" + dateTime +
", description='" + description + '\'' +
", calories=" + calories +
", excess=" + excess +
'}';
}
}