/
Apathy21
/
company
Обзор
Документация
Войти
/
Apathy21
/
company
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MainService/src/main/java/org/example/Entity/Address.java
110 строк
2 KB
alexeev509
Skeletop company app realization
13 сен 2024, 19:21
13 сен 2024, 19:21
2a02e11
Код
Авторство
О чём код?
package org.example.Entity; import jakarta.persistence.*; import java.io.Serializable; import java.util.Objects; @Entity @Table(name = "address") public class Address implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private Integer post_code; private String city; private String avenue; // TODO: it's normal to have primitive value in entity class ? private short house; private Integer apartment; public Address() { } public Address(Long id, Integer post_code, String city, String avenue, short house, Integer apartment) { this.id = id; this.post_code = post_code; this.city = city; this.avenue = avenue; this.house = house; this.apartment = apartment; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getPost_code() { return post_code; } public void setPost_code(Integer post_code) { this.post_code = post_code; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getAvenue() { return avenue; } public void setAvenue(String avenue) { this.avenue = avenue; } public short getHouse() { return house; } public void setHouse(short house) { this.house = house; } public Integer getApartment() { return apartment; } public void setApartment(Integer apartment) { this.apartment = apartment; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Address address = (Address) o; return post_code == address.post_code && house == address.house && apartment == address.apartment && Objects.equals(id, address.id) && Objects.equals(city, address.city) && Objects.equals(avenue, address.avenue); } @Override public int hashCode() { return Objects.hash(id, post_code, city, avenue, house, apartment); } @Override public String toString() { return "Address{" + "id=" + id + ", post_code=" + post_code + ", city='" + city + '\'' + ", avenue='" + avenue + '\'' + ", house=" + house + ", apartment=" + apartment + '}'; } }