Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.twitter.poruke;
- import java.util.GregorianCalendar;
- public class TwitterPoruka {
- private String korisnik;
- private String poruka;
- private GregorianCalendar vreme;
- public String getKorisnik() {
- return korisnik;
- }
- public void setKorisnik(String korisnik) {
- if(korisnik==null && korisnik.isEmpty()) {
- throw new RuntimeException("Nedovoljena vrednost");
- }
- this.korisnik = korisnik;
- }
- public String getPoruka() {
- return poruka;
- }
- public void setPoruka(String poruka) {
- if(poruka==null || poruka.length()>140) {
- throw new RuntimeException("Nedovoljena vrednost");
- }
- this.poruka = poruka;
- }
- public GregorianCalendar getVreme() {
- return vreme;
- }
- public void setVreme(GregorianCalendar vreme) {
- if(vreme==null || vreme.after(new GregorianCalendar())) {
- throw new RuntimeException("Nedovoljena vrednost");
- }
- this.vreme = vreme;
- }
- @Override
- public String toString() {
- return "KORISNIK_"+korisnik+"_VREME_"+vreme+"_PORUKA_"+poruka;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement