new enumeration CdmBaseTypes.java : Enumeration of all abstract CDM base types. Each...
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / strategy / StrategyBase.java
1 /**
2 * Copyright (C) 2009 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
10 package eu.etaxonomy.cdm.strategy;
11
12 import java.io.Serializable;
13 import java.net.URI;
14 import java.util.Collection;
15 import java.util.UUID;
16
17 import org.apache.log4j.Logger;
18 import org.joda.time.DateTime;
19
20 import eu.etaxonomy.cdm.model.agent.Contact;
21 import eu.etaxonomy.cdm.model.common.CdmBase;
22 import eu.etaxonomy.cdm.model.common.LSID;
23 import eu.etaxonomy.cdm.model.common.TimePeriod;
24
25
26 public abstract class StrategyBase implements IStrategy, Serializable {
27 private static final long serialVersionUID = -274791080847215663L;
28 @SuppressWarnings("unused")
29 private static final Logger logger = Logger.getLogger(StrategyBase.class);
30
31 final static UUID uuid = UUID.fromString("2ff2b1d6-17a6-4807-a55f-f6b45bf429b7");
32
33 abstract protected UUID getUuid();
34
35 protected StrategyBase(){
36 }
37
38
39
40
41 /**
42 * @param fieldType
43 * @return
44 */
45 protected static boolean isCollection(Class<?> fieldType) {
46 if (Collection.class.isAssignableFrom(fieldType) ){
47 return true;
48 }else{
49 return false;
50 }
51 }
52
53 /**
54 * @param fieldType
55 * @return
56 */
57 protected boolean isPrimitive(Class<?> fieldType) {
58 if (fieldType.isPrimitive()){
59 return true;
60 }else{
61 return false;
62 }
63 }
64
65 /**
66 * @param fieldType
67 * @return
68 */
69 protected boolean isSingleCdmBaseObject(Class<?> fieldType) {
70 if (CdmBase.class.isAssignableFrom(fieldType)){
71 return true;
72 }else{
73 return false;
74 }
75 }
76
77 /**
78 * @param fieldType
79 * @return
80 */
81 protected boolean isUserType(Class<?> fieldType) {
82 if ( fieldType == TimePeriod.class ||
83 fieldType == DateTime.class ||
84 fieldType == LSID.class ||
85 fieldType == Contact.class ||
86 fieldType == URI.class
87 ){
88 return true;
89 }else{
90 return false;
91 }
92 }
93
94
95 }