Biblioteca Java - Blame information for rev 14

Subversion Repositories:
Rev:
Rev Author Line No. Line
14 mihai 1 /*
2  * Copyright 2012 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 hm.spring.web.domain;
17  
18 /**
19  * @author Oliver Gierke
20  * @author Thomas Risberg
21  */
22 public class AbstractEntity {
23  
24         private Integer id;
25  
26         public Integer getId() {
27                 return id;
28         }
29  
30         public void setId(Integer id) {
31                 this.id = id;
32         }
33  
34         /*
35          * (non-Javadoc)
36          * @see java.lang.Object#equals(java.lang.Object)
37          */
38         @Override
39         public boolean equals(Object obj) {
40  
41                 if (this == obj) {
42                         return true;
43                 }
44  
45                 if (this.id == null || obj == null || !(this.getClass().equals(obj.getClass()))) {
46                         return false;
47                 }
48  
49                 AbstractEntity that = (AbstractEntity) obj;
50  
51                 return this.id.equals(that.getId());
52         }
53  
54         /*
55          * (non-Javadoc)
56          * @see java.lang.Object#hashCode()
57          */
58         @Override
59         public int hashCode() {
60                 return id == null ? 0 : id.hashCode();
61         }
62 }