Project

General

Profile

Download (1.19 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 java.util.UUID;
12

    
13
import org.apache.commons.lang.builder.HashCodeBuilder;
14

    
15
public class EntityReference {
16
    UUID uuid;
17
    String label;
18

    
19
    public EntityReference(UUID uuid, String label) {
20
        this.uuid = uuid;
21
        this.label = label;
22
    }
23

    
24

    
25
    public UUID getUuid() {
26
        return uuid;
27
    }
28

    
29
    public String getLabel() {
30
        return label;
31
    }
32

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

    
44
    /**
45
     * {@inheritDoc}
46
     */
47
    @Override
48
    public boolean equals(Object obj) {
49
        try {
50
            EntityReference other = (EntityReference) obj;
51
            return uuid.equals(other.uuid) && label.equals(other.label);
52

    
53
        } catch (Exception e) {
54
            return false;
55
        }
56
    }
57

    
58
}
(4-4/7)