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