Java Reference
In-Depth Information
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Question {
static final SimpleDateFormat sdf = new SimpleDateFormat ("dd-MM-YY");
private StringProperty ownerProperty = new SimpleStringProperty();
private String question;
private long timestamp;
public Question (String o, String q, long t) {
this.ownerProperty.set(o);
this.question = q;
this.timestamp = t;
}
public String getOwner() {
return ownerProperty.get();
}
public void setOwner(String owner) {
this.ownerProperty.set(owner);
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getTimestampString() {
return sdf.format(new Date(timestamp));
}
}
There are a few things to note about this implementation. The ownerProperty follows the standard JavaFX
Convention, as explained in Chapter 3.
Apart from the introduction of JavaFX Properties, there is another major change in the implementation of the
Question class. The class is now annotated with
@XmlAccessorType(XmlAccessType.PROPERTY)
 
Search WWH ::




Custom Search