Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package eksam2018;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import org.codehaus.jackson.annotate.*;
- /**
- *
- * @author Rasmus
- */
- @JsonPropertyOrder({"id","Kaup","Kogus","MuumisePaev"})
- public class SaleGoods implements java.io.Serializable{
- @JsonProperty("id")
- private Long id;
- @JsonProperty("Kaup")
- private Goods kaup;
- @JsonProperty("Kogus")
- private Long kogus;
- @JsonProperty("MuumisePaev")
- private Date muuk; // valjad
- public SaleGoods(Long id, Goods kaup, Long kogus, Date muuk) { // konstruktorid
- this.id = id;
- this.kaup = kaup;
- this.kogus = kogus;
- this.muuk = muuk;
- }
- public SaleGoods() {
- }
- public Long getId() { // get/set meetodid
- return id;
- }
- public Goods getKaup() {
- return kaup;
- }
- public Long getKogus() {
- return kogus;
- }
- public Date getMuuk() {
- return muuk;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public void setKaup(Goods kaup) {
- this.kaup = kaup;
- }
- public void setKogus(Long kogus) {
- this.kogus = kogus;
- }
- public void setMuuk(Date muuk) {
- this.muuk = muuk;
- }
- @Override
- public String toString() { // uus to string meetod
- SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
- String formatted = formatter.format(muuk); // data vormistamine
- return "\n{\"ID\":"+id+", \"Kaup\":\""+kaup.toString()+"\", \"Kogus\":\""+kogus+"\", \"MuumisePaev\":\""+formatted+"}"; //To change body of generated methods, choose Tools | Templates.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement