Project

General

Profile

Download (1.33 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.ref;
10

    
11
import java.io.Serializable;
12
import java.util.UUID;
13

    
14
import org.apache.commons.lang3.builder.HashCodeBuilder;
15

    
16
/**
17
 * @author a.kohlbecker
18
 */
19
public class EntityReference implements Serializable{
20

    
21
    private static final long serialVersionUID = -8173845668898512626L;
22

    
23
    UUID uuid;
24
    String label;
25

    
26
    public EntityReference(UUID uuid, String label) {
27
        this.uuid = uuid;
28
        this.label = label;
29
    }
30

    
31

    
32
    public UUID getUuid() {
33
        return uuid;
34
    }
35

    
36
    public String getLabel() {
37
        return label;
38
    }
39

    
40
    /**
41
     * {@inheritDoc}
42
     */
43
    @Override
44
    public int hashCode() {
45
        return new HashCodeBuilder(17, 31)
46
                .append(label)
47
                .append(uuid)
48
                .toHashCode();
49
    }
50

    
51
    /**
52
     * {@inheritDoc}
53
     */
54
    @Override
55
    public boolean equals(Object obj) {
56
        try {
57
            EntityReference other = (EntityReference) obj;
58
            return uuid.equals(other.uuid) && label.equals(other.label);
59

    
60
        } catch (Exception e) {
61
            return false;
62
        }
63
    }
64

    
65
}
(1-1/2)