--- /dev/null
+package net.wpitchoune.pnews;
+
+import java.time.Instant;
+import java.util.concurrent.atomic.AtomicLong;
+
+public class Article {
+ private final String title;
+ private final String description;
+ private final String thumbnail;
+ private final String link;
+ private final Instant publicationDate;
+ private final String website;
+ private final String[] entities;
+ private final AtomicLong readCount = new AtomicLong();
+
+ public Article(String link, String title, String description, String thumbnail, Instant publicationDate, String website, String[] entities) {
+ this.link = link;
+ this.title = title;
+ this.description = description;
+ this.thumbnail = thumbnail;
+ this.publicationDate = publicationDate;
+ this.website = website;
+ this.entities = entities;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public String getThumbnail() {
+ return thumbnail;
+ }
+
+ public String getWebsite() {
+ return website;
+ }
+
+ public long getReadCount() {
+ return readCount.get();
+ }
+
+ public String[] getEntities() {
+ return entities;
+ }
+
+ public boolean hasEntity(String entity) {
+ for (String e: entities)
+ if (e.equals(entity))
+ return true;
+
+ return false;
+ }
+
+ public Instant getPublicationDate() {
+ return publicationDate;
+ }
+
+ public void incrementReadCount() {
+ readCount.incrementAndGet();
+ }
+}