Project

General

Profile

« Previous | Next » 

Revision 1d9ed98e

Added by Andreas Kohlbecker over 3 years ago

ref #9238 extending SpecimenTypeDesignationDTO with more fields and associated DTOs, introducing ReferenceDTO, supressing unwanted and dangerous fields of RegistrationDTO

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/ref/TypedEntityReference.java
12 12

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

  
15
import eu.etaxonomy.cdm.model.common.CdmBase;
16
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
17

  
15 18
/**
16 19
 * @author a.kohlbecker
17 20
 * @since Jun 12, 2017
......
37 40
        this.type = type;
38 41
    }
39 42

  
43
    public static <T> TypedEntityReference<T> fromCdmBase(CdmBase entity) {
44
        if(entity == null) {
45
            return null;
46
        }
47
        return new TypedEntityReference<T>((Class<T>)entity.getClass(), entity.getUuid());
48
    }
49

  
50
    public static <T> TypedEntityReference<T> fromIdentifiableEntity(IdentifiableEntity<?> entity) {
51
        if(entity == null) {
52
            return null;
53
        }
54
        return new TypedEntityReference<T>((Class<T>)entity.getClass(), entity.getUuid());
55
    }
56

  
40 57
    public Class<T> getType() {
41 58
        return type;
42 59
    }

Also available in: Unified diff