package jsonfeed4j;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class JsonFeed {
  
  private Version version;
  private String title;
  private List<Item> items;
  private String homePageUrl;
  private String feedUrl;
  private String description;
  private String userComment;
  private String nextUrl;
  private String icon;
  private String favicon;
  private boolean expired;
  private Author author;
  private List<Hub> hubs = Collections.emptyList();
  private Map<String, Object> extensions = Collections.emptyMap();

  public Version getVersion() {
    return version;
  }

  public String getTitle() {
    return title;
  }

  public List<Item> getItems() {
    return items;
  }

  public Optional<String> getHomePageUrl() {
    return Optional.ofNullable(homePageUrl);
  }

  public Optional<String> getFeedUrl() {
    return Optional.ofNullable(feedUrl);
  }

  public Optional<String> getDescription() {
    return Optional.ofNullable(description);
  }

  public Optional<String> getUserComment() {
    return Optional.ofNullable(userComment);
  }

  public Optional<String> getNextUrl() {
    return Optional.ofNullable(nextUrl);
  }
  
  public Optional<String> getIcon() {
    return Optional.ofNullable(icon);
  }

  public Optional<String> getFavicon() {
    return Optional.ofNullable(favicon);
  }

  public boolean isExpired() {
    return expired;
  }
  
  public Optional<Author> getAuthor() {
    return Optional.ofNullable(author);
  }

  public Extensions getExtensions() {
    return new Extensions(extensions);
  }

  public List<Hub> getHubs() {
    return hubs;
  }
}

@@ -117,16 +117,139 @@
 ional;%0A%0A
+import javax.validation.Valid;%0Aimport javax.validation.constraints.NotNull;%0A%0Aimport jsonfeed4j.validation.RequiredString;%0A%0A
 public c
@@ -267,16 +267,27 @@
 ed %7B%0A  %0A
+  @NotNull%0A
   privat
@@ -301,24 +301,42 @@
 on version;%0A
+  @RequiredString%0A
   private St
@@ -347,16 +347,25 @@
  title;%0A
+  @Valid%0A
   privat
@@ -602,16 +602,25 @@
 xpired;%0A
+  @Valid%0A
   privat
@@ -636,16 +636,25 @@
 author;%0A
+  @Valid%0A
   privat

Validate required fields and nested objects in JsonFeed