Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package com.twitter.poruke;
  2.  
  3. import java.util.GregorianCalendar;
  4.  
  5. public class TwitterPoruka {
  6. private String korisnik;
  7. private String poruka;
  8. private GregorianCalendar vreme;
  9.  
  10. public String getKorisnik() {
  11. return korisnik;
  12. }
  13. public void setKorisnik(String korisnik) {
  14. if(korisnik==null && korisnik.isEmpty()) {
  15. throw new RuntimeException("Nedovoljena vrednost");
  16. }
  17. this.korisnik = korisnik;
  18. }
  19. public String getPoruka() {
  20. return poruka;
  21. }
  22. public void setPoruka(String poruka) {
  23. if(poruka==null || poruka.length()>140) {
  24. throw new RuntimeException("Nedovoljena vrednost");
  25. }
  26. this.poruka = poruka;
  27. }
  28. public GregorianCalendar getVreme() {
  29. return vreme;
  30. }
  31. public void setVreme(GregorianCalendar vreme) {
  32. if(vreme==null || vreme.after(new GregorianCalendar())) {
  33. throw new RuntimeException("Nedovoljena vrednost");
  34. }
  35. this.vreme = vreme;
  36. }
  37. @Override
  38. public String toString() {
  39. return "KORISNIK_"+korisnik+"_VREME_"+vreme+"_PORUKA_"+poruka;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement