78 lines
1.5 KiB
Java
78 lines
1.5 KiB
Java
package model;
|
|
|
|
import java.text.DateFormat;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
|
|
public class NewsModel {
|
|
|
|
private String author;
|
|
private String source;
|
|
private String imageURL;
|
|
private String newsURL;
|
|
private String title;
|
|
private String description;
|
|
private Date date;
|
|
|
|
|
|
public String getAuthor() {
|
|
return author;
|
|
}
|
|
public NewsModel setAuthor(String author) {
|
|
this.author = author;
|
|
return this;
|
|
}
|
|
public String getSource() {
|
|
return source;
|
|
}
|
|
public NewsModel setSource(String source) {
|
|
this.source = source;
|
|
return this;
|
|
}
|
|
public String getImageURL() {
|
|
return imageURL;
|
|
}
|
|
public NewsModel setImageURL(String imageURL) {
|
|
this.imageURL = imageURL;
|
|
return this;
|
|
}
|
|
public String getNewsURL() {
|
|
return newsURL;
|
|
}
|
|
public NewsModel setNewsURL(String newsURL) {
|
|
this.newsURL = newsURL;
|
|
return this;
|
|
}
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
public NewsModel setTitle(String title) {
|
|
this.title = title;
|
|
return this;
|
|
}
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
public NewsModel setDescription(String description) {
|
|
this.description = description;
|
|
return this;
|
|
}
|
|
public Date getDate() {
|
|
return date;
|
|
}
|
|
public NewsModel setDate(String date) throws ParseException {
|
|
//on déclare le format de date
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
|
|
date = date.replace("Z", "+0000");
|
|
this.date = fmt.parse(date);
|
|
return this;
|
|
}
|
|
|
|
public NewsModel setDate(Date date){
|
|
this.date = date;
|
|
return this;
|
|
}
|
|
|
|
}
|