@SuppressWarnings("unchecked") @Override public void readExternal(ObjectInput arg0) throws IOException, ClassNotFoundException { createdDate = (LocalDate) arg0.readObject(); createdTime = (LocalTime) arg0.readObject(); user = (User) arg0.readObject(); serveAtDate = (LocalDate) arg0.readObject(); serveAtTime = (LocalTime) arg0.readObject(); active = (boolean) arg0.readObject(); number = (String) arg0.readObject(); orderedMeals = (ArrayList<MealAndQuantity>) arg0.readObject(); sspCreatedDate = new SimpleStringProperty(createdDate.toString()); sspCreatedTime = new SimpleStringProperty(createdTime.toString()); sspOrderedMeals = new SimpleStringProperty(); sspUserName = new SimpleStringProperty(user.getUserName().get()); sspNumber = new SimpleStringProperty(number.toString()); sspServeAtDate = new SimpleStringProperty(serveAtDate.toString()); sspServeAtTime = new SimpleStringProperty(serveAtTime.toString()); sspPrice = new SimpleStringProperty(); sspCreatedAtCompact = new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString()); sspServeAtCompact = new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString()); }
public Order(User user, LocalDate serveAtDate, LocalTime serveAtTime) { createdDate = LocalDate.now(); createdTime = LocalTime.now(); this.user = user; this.serveAtDate = serveAtDate; this.serveAtTime = serveAtTime; orderedMeals = new ArrayList<>(); number = new String(createdDate + "-" + createdTime + "-" + (++user.orderCount)); sspCreatedDate = new SimpleStringProperty(createdDate.toString()); sspCreatedTime = new SimpleStringProperty(createdTime.toString()); sspOrderedMeals = new SimpleStringProperty(); sspUserName = new SimpleStringProperty(user.getUserName().get()); sspNumber = new SimpleStringProperty(number.toString()); sspServeAtDate = new SimpleStringProperty(serveAtDate.toString()); sspServeAtTime = new SimpleStringProperty(serveAtTime.toString()); sspPrice = new SimpleStringProperty(); sspCreatedAtCompact = new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString()); sspServeAtCompact = new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString()); }