Project

General

Profile

Download (1.14 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.model;
10

    
11
import org.apache.commons.lang.builder.HashCodeBuilder;
12

    
13
public class EntityReference {
14
    int id;
15
    String label;
16

    
17
    public EntityReference(int id, String label) {
18
        this.id = id;
19
        this.label = label;
20
    }
21

    
22
    public int getId() {
23
        return id;
24
    }
25

    
26
    public String getLabel() {
27
        return label;
28
    }
29

    
30
    /**
31
     * {@inheritDoc}
32
     */
33
    @Override
34
    public int hashCode() {
35
        return new HashCodeBuilder(17, 31)
36
                .append(label)
37
                .append(id)
38
                .toHashCode();
39
    }
40

    
41
    /**
42
     * {@inheritDoc}
43
     */
44
    @Override
45
    public boolean equals(Object obj) {
46
        try {
47
            EntityReference other = (EntityReference) obj;
48
            return id == other.id && label.equals(other.label);
49

    
50
        } catch (Exception e) {
51
            return false;
52
        }
53
    }
54

    
55
}
(4-4/7)