Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package warstwa_biznesowa.entity;
  7. import java.io.Serializable;
  8. import javax.persistence.Entity;
  9. import javax.persistence.GeneratedValue;
  10. import javax.persistence.GenerationType;
  11. import javax.persistence.Id;
  12. @Entity
  13. public class Produkt1 implements Serializable {
  14. private static final long serialVersionUID = 1L;
  15. @Id
  16. @GeneratedValue(strategy = GenerationType.AUTO)
  17. private Long id;
  18. private String nazwa_producenta;
  19. private String nazwa;
  20. private float cena;
  21. private int promocja;
  22.  
  23. public String getNazwa_producenta() {
  24. return nazwa_producenta;
  25. }
  26.  
  27. public void setNazwa_producenta(String nazwa_producenta) {
  28. this.nazwa_producenta = nazwa_producenta;
  29. }
  30.  
  31. public String getNazwa() {
  32. return nazwa;
  33. }
  34.  
  35. public void setNazwa(String nazwa) {
  36. this.nazwa = nazwa;
  37. }
  38.  
  39. public float getCena() {
  40. return cena;
  41. }
  42.  
  43. public void setCena(float cena) {
  44. this.cena = cena;
  45. }
  46.  
  47. public int getPromocja() {
  48. return promocja;
  49. }
  50.  
  51. public void setPromocja(int promocja) {
  52. this.promocja = promocja;
  53. }
  54. public float cena_brutto ()
  55. {
  56. float cena_brutto= cena*(1-(float)promocja/100);
  57. return cena_brutto;
  58. }
  59. public Long getId() {
  60. return id;
  61. }
  62. public void setId(Long id) {
  63. this.id = id;
  64. }
  65.  
  66. @Override
  67. public int hashCode() {
  68. int hash = 0;
  69. hash += (id != null ? id.hashCode() : 0);
  70. return hash;
  71. }
  72. @Override
  73. public boolean equals(Object object) {
  74. // TODO: Warning - this method won't work in the case the id fields are not set
  75. if (!(object instanceof Produkt1)) {
  76. return false;
  77. }
  78. Produkt1 other = (Produkt1) object;
  79. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  80. return false;
  81. }
  82. return true;
  83. }
  84. @Override
  85. public String toString() {
  86. return "warstwa_biznesowa.entity.Produkt1[ id=" + id + " ]";
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement