Plant.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package com.example.plantsforyou.plant;
  2. import com.example.plantsforyou.plant.enums.PlantCareDifficulty;
  3. import com.example.plantsforyou.plant.enums.PlantSize;
  4. import com.example.plantsforyou.plant.enums.PlantTypeOfLight;
  5. import lombok.AllArgsConstructor;
  6. import lombok.Getter;
  7. import lombok.NoArgsConstructor;
  8. import lombok.Setter;
  9. import javax.persistence.*;
  10. @Getter
  11. @Setter
  12. @NoArgsConstructor
  13. @Entity
  14. @AllArgsConstructor
  15. public class Plant {
  16. @Id
  17. @Column
  18. @GeneratedValue(strategy = GenerationType.IDENTITY)
  19. private Long id;
  20. private String name;
  21. private double price;
  22. private int quantity;
  23. private String imgURL;
  24. @Column(columnDefinition="TEXT")
  25. private String description;
  26. @Enumerated(EnumType.STRING)
  27. private PlantTypeOfLight typeOfLight;
  28. @Enumerated(EnumType.STRING)
  29. private PlantCareDifficulty difficulty;
  30. @Enumerated(EnumType.STRING)
  31. private PlantSize size;
  32. boolean inStock;
  33. public Plant(String name,
  34. double price,
  35. int quantity,
  36. String description,
  37. PlantTypeOfLight typeOfLight,
  38. PlantCareDifficulty difficulty,
  39. PlantSize size, boolean inStock) {
  40. this.name = name;
  41. this.price = price;
  42. this.quantity = quantity;
  43. this.description = description;
  44. this.typeOfLight = typeOfLight;
  45. this.difficulty = difficulty;
  46. this.size = size;
  47. this.inStock = inStock;
  48. }
  49. public Plant(String name, double price, int quantity, String imgURL, String description, PlantTypeOfLight typeOfLight, PlantCareDifficulty difficulty, PlantSize size, boolean inStock) {
  50. this.name = name;
  51. this.price = price;
  52. this.quantity = quantity;
  53. this.imgURL = imgURL;
  54. this.description = description;
  55. this.typeOfLight = typeOfLight;
  56. this.difficulty = difficulty;
  57. this.size = size;
  58. this.inStock = inStock;
  59. }
  60. public void setPrice(double price) {
  61. this.price = price;
  62. }
  63. public void setInStock(boolean inStock) {
  64. this.inStock = inStock;
  65. }
  66. }