Advertisement
Zizalik

Untitled

May 28th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 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 java.text.SimpleDateFormat;
  9. import java.util.Date;
  10. import org.codehaus.jackson.annotate.*;
  11.  
  12. /**
  13. *
  14. * @author Rasmus
  15. */
  16. @JsonPropertyOrder({"id","Kaup","Kogus","MuumisePaev"})
  17.  
  18. public class SaleGoods implements java.io.Serializable{
  19. @JsonProperty("id")
  20. private Long id;
  21. @JsonProperty("Kaup")
  22. private Goods kaup;
  23. @JsonProperty("Kogus")
  24. private Long kogus;
  25. @JsonProperty("MuumisePaev")
  26. private Date muuk; // valjad
  27.  
  28. public SaleGoods(Long id, Goods kaup, Long kogus, Date muuk) { // konstruktorid
  29. this.id = id;
  30. this.kaup = kaup;
  31. this.kogus = kogus;
  32. this.muuk = muuk;
  33. }
  34.  
  35. public SaleGoods() {
  36. }
  37.  
  38. public Long getId() { // get/set meetodid
  39. return id;
  40. }
  41.  
  42. public Goods getKaup() {
  43. return kaup;
  44. }
  45.  
  46. public Long getKogus() {
  47. return kogus;
  48. }
  49.  
  50. public Date getMuuk() {
  51. return muuk;
  52. }
  53.  
  54. public void setId(Long id) {
  55. this.id = id;
  56. }
  57.  
  58. public void setKaup(Goods kaup) {
  59. this.kaup = kaup;
  60. }
  61.  
  62. public void setKogus(Long kogus) {
  63. this.kogus = kogus;
  64. }
  65.  
  66. public void setMuuk(Date muuk) {
  67. this.muuk = muuk;
  68. }
  69.  
  70. @Override
  71. public String toString() { // uus to string meetod
  72. SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
  73. String formatted = formatter.format(muuk); // data vormistamine
  74. return "\n{\"ID\":"+id+", \"Kaup\":\""+kaup.toString()+"\", \"Kogus\":\""+kogus+"\", \"MuumisePaev\":\""+formatted+"}"; //To change body of generated methods, choose Tools | Templates.
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement