Boat.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package pl.sudra.domain;
  2. import jakarta.persistence.Entity;
  3. import jakarta.persistence.GeneratedValue;
  4. import jakarta.persistence.GenerationType;
  5. import jakarta.persistence.Id;
  6. import jakarta.validation.constraints.NotNull;
  7. @Entity
  8. public class Boat {
  9. @Id
  10. @GeneratedValue(strategy = GenerationType.AUTO)
  11. private Long id;
  12. @NotNull
  13. private String name;
  14. @NotNull
  15. private Integer capacity;
  16. @NotNull
  17. private Float cost;
  18. public Boat() {
  19. }
  20. public Long getId() {
  21. return id;
  22. }
  23. public void setId(Long id) {
  24. this.id = id;
  25. }
  26. public String getName() {
  27. return name;
  28. }
  29. public void setName(String name) {
  30. this.name = name;
  31. }
  32. public Integer getCapacity() {
  33. return capacity;
  34. }
  35. public void setCapacity(Integer capacity) {
  36. this.capacity = capacity;
  37. }
  38. public Float getCost() {
  39. return cost;
  40. }
  41. public void setCost(Float cost) {
  42. this.cost = cost;
  43. }
  44. @Override
  45. public String toString() {
  46. return "Boat{" +
  47. "name='" + name + '\'' +
  48. ", capacity=" + capacity +
  49. ", cost=" + cost +
  50. '}';
  51. }
  52. public Boat(Long id, String name, Integer capacity, Float cost) {
  53. this.id = id;
  54. this.name = name;
  55. this.capacity = capacity;
  56. this.cost = cost;
  57. }
  58. }