(no commit message)
[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.lang.annotation.Annotation;
14 import java.lang.reflect.Field;
15 import java.lang.reflect.Modifier;
16 import java.util.Collection;
17 import java.util.HashMap;
18 import java.util.Map;
19 import java.util.UUID;
20
21 import javax.persistence.Transient;
22
23 import org.apache.log4j.Logger;
24 import org.joda.time.DateTime;
25
26 import eu.etaxonomy.cdm.model.agent.Contact;
27 import eu.etaxonomy.cdm.model.common.CdmBase;
28 import eu.etaxonomy.cdm.model.common.LSID;
29 import eu.etaxonomy.cdm.model.common.TimePeriod;
30
31
32 public abstract class StrategyBase implements IStrategy, Serializable {
33 private static final long serialVersionUID = -274791080847215663L;
34 @SuppressWarnings("unused")
35 private static final Logger logger = Logger.getLogger(StrategyBase.class);
36
37 final static UUID uuid = UUID.fromString("2ff2b1d6-17a6-4807-a55f-f6b45bf429b7");
38
39 abstract protected UUID getUuid();
40
41 protected StrategyBase(){
42 }
43
44
45
46
47 /**
48 * @param fieldType
49 * @return
50 */
51 protected static boolean isCollection(Class<?> fieldType) {
52 if (Collection.class.isAssignableFrom(fieldType) ){
53 return true;
54 }else{
55 return false;
56 }
57 }
58
59 /**
60 * @param fieldType
61 * @return
62 */
63 protected boolean isPrimitive(Class<?> fieldType) {
64 if (fieldType.isPrimitive()){
65 return true;
66 }else{
67 return false;
68 }
69 }
70
71 /**
72 * @param fieldType
73 * @return
74 */
75 protected boolean isSingleCdmBaseObject(Class<?> fieldType) {
76 if (CdmBase.class.isAssignableFrom(fieldType)){
77 return true;
78 }else{
79 return false;
80 }
81 }
82
83 /**
84 * @param fieldType
85 * @return
86 */
87 protected boolean isUserType(Class<?> fieldType) {
88 if ( fieldType == TimePeriod.class ||
89 fieldType == DateTime.class ||
90 fieldType == LSID.class ||
91 fieldType == Contact.class
92 ){
93 return true;
94 }else{
95 return false;
96 }
97 }
98
99
100 }