/** * Constructs task with all given data * * @param id is unique identificator in dao * @param name is title of task * @param description -\\- * @param contacts * @param date is point in time when the task to launch */ public Task(String id, String name, String description, Date date) { this.id = id; this.name = name; this.description = description; this.date = date; setAlive(); // why it asked to make class Task final? }
public Task(String id, String name, String description, String date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(ConfigReader.getInstance().getDateFormat()); this.id = id; this.name = name; this.description = description; try { this.date = sdf.parse(date); } catch (ParseException ex) { log.error("DateString didn't matched pattern: " + date, ex); throw new ParseException("DateString didn't matched pattern: " + date, ex.getErrorOffset()); } setAlive(); // why it asked to make class Task final? }