2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.ref
;
11 import java
.util
.UUID
;
13 import org
.apache
.commons
.lang
.builder
.HashCodeBuilder
;
16 * @author a.kohlbecker
20 public class TypedEntityReference
<T
> extends EntityReference
{
22 private static final long serialVersionUID
= -4619590272174606288L;
24 private Class
<T
> type
;
30 public TypedEntityReference(Class
<T
> type
, UUID uuid
, String label
) {
35 public TypedEntityReference(Class
<T
> type
, UUID uuid
) {
40 public Class
<T
> getType() {
43 public void setType(Class
<T
> type
) {
51 public int hashCode() {
52 return new HashCodeBuilder(17, 31)
54 .appendSuper(type
.hashCode())
61 @SuppressWarnings("rawtypes")
63 public boolean equals(Object obj
) {
65 TypedEntityReference other
= (TypedEntityReference
) obj
;
66 return uuid
.equals(other
.uuid
) && type
.equals(other
.type
);
68 } catch (Exception e
) {
74 public String
toString(){
75 return type
.getSimpleName() + "#" + uuid
;