View Javadoc
1   /**
2    *    Copyright 2009-2015 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.domain.blog;
17  
18  import java.io.Serializable;
19  
20  public class Author implements Serializable {
21  
22    protected int id;
23    protected String username;
24    protected String password;
25    protected String email;
26    protected String bio;
27    protected Section favouriteSection;
28  
29    public Author() {
30      this(-1, null, null, null, null, null);
31    }
32  
33    public Author(Integer id, String username, String password, String email, String bio, Section section) {
34      this.id = id;
35      this.username = username;
36      this.password = password;
37      this.email = email;
38      this.bio = bio;
39      this.favouriteSection = section;
40    }
41  
42    public Author(int id) {
43      this(id, null, null, null, null, null);
44    }
45  
46    public void setId(int id) {
47      this.id = id;
48    }
49  
50    public void setUsername(String username) {
51      this.username = username;
52    }
53  
54    public void setPassword(String password) {
55      this.password = password;
56    }
57  
58    public void setEmail(String email) {
59      this.email = email;
60    }
61  
62    public void setBio(String bio) {
63      this.bio = bio;
64    }
65  
66    public void setFavouriteSection(Section favouriteSection) {
67      this.favouriteSection = favouriteSection;
68    }
69  
70    public int getId() {
71      return id;
72    }
73  
74    public String getUsername() {
75      return username;
76    }
77  
78    public String getPassword() {
79      return password;
80    }
81  
82    public String getEmail() {
83      return email;
84    }
85  
86    public String getBio() {
87      return bio;
88    }
89  
90    public Section getFavouriteSection() {
91      return favouriteSection;
92    }
93  
94    @Override
95    public boolean equals(Object o) {
96      if (this == o) return true;
97      if (!(o instanceof Author)) return false;
98  
99      Author../../../../../org/apache/ibatis/domain/blog/Author.html#Author">Author author = (Author) o;
100 
101     if (id != author.id) return false;
102     if (bio != null ? !bio.equals(author.bio) : author.bio != null) return false;
103     if (email != null ? !email.equals(author.email) : author.email != null) return false;
104     if (password != null ? !password.equals(author.password) : author.password != null) return false;
105     if (username != null ? !username.equals(author.username) : author.username != null) return false;
106     if (favouriteSection != null ? !favouriteSection.equals(author.favouriteSection) : author.favouriteSection != null)
107       return false;
108 
109     return true;
110   }
111 
112   @Override
113   public int hashCode() {
114     int result;
115     result = id;
116     result = 31 * result + (username != null ? username.hashCode() : 0);
117     result = 31 * result + (password != null ? password.hashCode() : 0);
118     result = 31 * result + (email != null ? email.hashCode() : 0);
119     result = 31 * result + (bio != null ? bio.hashCode() : 0);
120     result = 31 * result + (favouriteSection != null ? favouriteSection.hashCode() : 0);
121     return result;
122   }
123 
124   @Override
125   public String toString() {
126     return "Author : " + id + " : " + username + " : " + email;
127   }
128 }