Advertisement
Zizalik

Goods

May 28th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 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 eksam2018;
  7.  
  8. import org.codehaus.jackson.annotate.JsonCreator;
  9. import org.codehaus.jackson.annotate.JsonProperty;
  10. import org.codehaus.jackson.annotate.JsonPropertyOrder;
  11.  
  12. /**
  13. *
  14. * @author t166038
  15. */
  16.  
  17. @JsonPropertyOrder({
  18. "id",
  19. "Nimetus",
  20. "Tootja",
  21. "Hind"
  22. })
  23. public class Goods implements java.io.Serializable{
  24. @JsonProperty("id")
  25. private Long id;
  26. @JsonProperty("Nimetus")
  27. private String nimetus;
  28. @JsonProperty("Tootja")
  29. private String tootja;
  30. @JsonProperty("Hind")
  31. private Double hind; // valjad
  32.  
  33. @JsonCreator
  34. public Goods(Long id, String nimetus, String tootja, Double hind) {
  35. this.id = id;
  36. this.nimetus = nimetus;
  37. this.tootja = tootja;
  38. this.hind = hind; // konstruktor
  39. }
  40.  
  41. public Goods() {
  42. }
  43.  
  44. public Long getId() { // get/set meetodid
  45. return id;
  46. }
  47.  
  48. public String getNimetus() {
  49. return nimetus;
  50. }
  51.  
  52. public String getTootja() {
  53. return tootja;
  54. }
  55.  
  56. public Double getHind() {
  57. return hind;
  58. }
  59.  
  60. public void setId(Long id) {
  61. this.id = id;
  62. }
  63.  
  64. public void setNimetus(String nimetus) {
  65. this.nimetus = nimetus;
  66. }
  67.  
  68. public void setTootja(String tootja) {
  69. this.tootja = tootja;
  70. }
  71.  
  72. public void setHind(Double hind) {
  73. this.hind = hind;
  74. }
  75.  
  76. @Override
  77. public String toString() { // uus toString meetod
  78. return "\n{\"ID\":"+id+", \"Nimetus\":\""+nimetus+"\", \"Tootja\":\""+tootja+"\", \"Hind\":\""+hind+"}";
  79. }
  80.  
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement