Projekt

Obecné

Profil

Stáhnout (958 Bajtů) Statistiky
| Větev: | Revize:
1
package vldc.aswi.domain;
2

    
3
import javax.persistence.*;
4

    
5
import lombok.Data;
6

    
7
/**
8
 * Class which is extended for all domain entities containing common attributes.
9
 */
10
@MappedSuperclass
11
@Data
12
public class EntityParent {
13

    
14
    /** Specific identificator for every table. */
15
    @Id
16
    @Column(name="ID")
17
    @GeneratedValue(strategy=GenerationType.IDENTITY)
18
    private Long id;
19

    
20
    /**
21
     * Equal method for comparing two objects.
22
     * @param obj - Comparing object.
23
     * @return true if objects are same.
24
     */
25
    @Override
26
    public boolean equals(Object obj) {
27
        if(this == obj) {
28
            return true;
29
        }
30

    
31
        if(obj == null || obj.getClass()!= this.getClass()) {
32
            return false;
33
        }
34

    
35
        // type casting of the argument.
36
        EntityParent parent = (EntityParent) obj;
37

    
38
        if (parent.getId() == null) {
39
            return false;
40
        }
41

    
42
        return (parent.getId() == this.getId());
43
    }
44
}
(3-3/8)