Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package fr.vidal.oss.jaxb.atom.core;
  
  import java.util.Date;
  import java.util.Objects;
 
 import static fr.vidal.oss.jaxb.atom.core.Preconditions.checkState;
 import static java.util.Collections.unmodifiableCollection;
 
 @XmlType(propOrder = {
     "title""links""category""author""id""publishedDate""updateDate""summary""contents""additionalElements"
 })
 public class Entry {
 
     @XmlElement(name = "title", required = true)
     private final String title;
     @XmlElement(name = "summary")
     private final Summary summary;
     @XmlElement(name = "category")
     private final Category category;
     @XmlElement(name = "id", required = true)
     private final String id;
     @XmlElement(name = "published")
     private final Date publishedDate;
     @XmlElement(name = "updated", required = true)
     private final Date updateDate;
     @XmlElement(name = "author")
     private final Author author;
     @XmlElement(name = "content")
     private final Contents contents;
     @XmlElement(name = "link", required = true)
     private final Collection<Linklinks;
     @XmlAnyElement
     private final Collection<SimpleElementadditionalElements;
 
     @SuppressWarnings("unused")
     private Entry() {
         this(builder());
     }
 
     private Entry(Builder builder) {
          = builder.additionalElements;
          = builder.author;
          = builder.category;
          = builder.contents;
          = builder.id;
          = builder.links;
          = builder.summary;
          = builder.title;
          = builder.publishedDate;
          = builder.updateDate;
     }
 
     public static Builder builder() {
         return new Builder();
     }
 
     public String getTitle() {
         return ;
     }
 
     public Summary getSummary() {
         return ;
     }
 
     public Category getCategory() {
         return ;
     }
 
     public String getId() {
         return ;
     }
 
     public Date getPublishedDate() {
         return ;
     }
 
     public Date getUpdateDate() {
         return ;
     }
 
     public Author getAuthor() {
         return ;
     }
 
     public Contents getContents() {
         return ;
     }
 
     public Collection<LinkgetLinks() {
         return unmodifiableCollection();
     }
 
         return unmodifiableCollection();
    }
    @Override
    public int hashCode() {
        return Objects.hash();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        final Entry other = (Entryobj;
        return Objects.equals(this.other.id);
    }
    @Override
    public String toString() {
        return "Entry{" +
            "title='" +  + '\'' +
            ", summary=" +  +
            ", category=" +  +
            ", id='" +  + '\'' +
            ", publishedDate=" +  +
            ", updateDate=" +  +
            ", author=" +  +
            ", contents=" +  +
            ", links=" +  +
            ", additionalElements=" +  +
            '}';
    }
    public static class Builder {
        private String title;
        private Summary summary;
        private Category category;
        private String id;
        private Date publishedDate;
        private Date updateDate;
        private Author author;
        private Contents contents = .;
        private Collection<Linklinks = new LinkedHashSet<>();
        private Collection<SimpleElementadditionalElements = new LinkedHashSet<>();
        private Builder() {
        }
        public Builder withTitle(String title) {
            this. = title;
            return this;
        }
        public Builder withSummary(Summary summary) {
            this. = summary;
            return this;
        }
        public Builder withCategory(Category category) {
            this. = category;
            return this;
        }
        public Builder withId(String id) {
            this. = id;
            return this;
        }
        public Builder withPublishedDate(final Date publishedDate){
            this. = publishedDate;
            return this;
        }
        public Builder withUpdateDate(Date updateDate){
            this. = updateDate;
            return this;
        }
        public Builder withAuthor(Author author) {
            this. = author;
            return this;
        }
        public Builder withContents(Contents contents) {
            this. = contents;
            return this;
        }
        public Builder addLink(Link link) {
            this..add(link);
            return this;
        }
        public Builder addSimpleElement(SimpleElement simpleElement) {
            this..add(simpleElement);
            return this;
        }
        public Entry build() {
            checkState( != null"title is mandatory");
            checkState( != null"id is mandatory");
            checkState( != null"updateDate is mandatory");
            checkState(!.isEmpty(), "links cannot be empty");
            return new Entry(this);
        }
    }
New to GrepCode? Check out our FAQ X