Project

General

Profile

Download (1.23 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2012 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.dataportal.elements;
10

    
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
13
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
14
import eu.etaxonomy.cdm.model.name.TextualTypeDesignation;
15

    
16
/**
17
 * @author andreas
18
 * @since Jul 30, 2012
19
 *
20
 */
21
public enum TypeDesignationType {
22

    
23
    nameTypeDesignation, specimenTypeDesignation, textualTypeDesignation;
24

    
25
    public static TypeDesignationType valueOfCdmClass(Class<? extends CdmBase> type){
26
        if(type.equals(SpecimenTypeDesignation.class)){
27
            return TypeDesignationType.specimenTypeDesignation;
28
        }
29
        if(type.equals(NameTypeDesignation.class)){
30
            return TypeDesignationType.nameTypeDesignation;
31
        }
32
        if(type.equals(TextualTypeDesignation.class)){
33
            return TypeDesignationType.textualTypeDesignation;
34
        }
35
        throw new IllegalArgumentException("no enum constant matching " + type.toString());
36
    }
37

    
38
}
(23-23/23)