1d0c17cb75c93960e603c10356e9c4069d5bfccf
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / CdmSingleAttributeMapperBase.java
1 /**
2 * Copyright (C) 2007 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.io.common;
11
12 import java.util.ArrayList;
13 import java.util.HashSet;
14 import java.util.List;
15 import java.util.Set;
16
17 import org.apache.log4j.Logger;
18
19 /**
20 * @author a.mueller
21 * @created 05.08.2008
22 * @version 1.0
23 */
24 public abstract class CdmSingleAttributeMapperBase extends CdmAttributeMapperBase{
25 @SuppressWarnings("unused")
26 private static final Logger logger = Logger.getLogger(CdmSingleAttributeMapperBase.class);
27
28 private String sourceValue;
29 private String destinationValue;
30 protected Object defaultValue;
31
32 protected CdmSingleAttributeMapperBase(String sourceAttributString, String destinationAttributeString){
33 this(sourceAttributString,destinationAttributeString, null);
34 }
35
36 protected CdmSingleAttributeMapperBase(String sourceAttributString, String destinationAttributeString, Object defaultValue){
37 this.sourceValue = sourceAttributString;
38 this.destinationValue = destinationAttributeString;
39 this.defaultValue = defaultValue;
40 }
41
42
43 public String getSourceAttribute(){
44 return sourceValue;
45 }
46
47 public String getDestinationAttribute(){
48 return destinationValue;
49 }
50
51 @Override
52 public Set<String> getSourceAttributes(){
53 Set<String> result = new HashSet<String>();
54 result.add(sourceValue);
55 return result;
56 }
57
58 @Override
59 public Set<String> getDestinationAttributes(){
60 Set<String> result = new HashSet<String>();
61 result.add(destinationValue);
62 return result;
63 }
64
65
66 @Override
67 public List<String> getSourceAttributeList(){
68 List<String> result = new ArrayList<String>();
69 result.add(sourceValue);
70 return result;
71 }
72
73 @Override
74 public List<String> getDestinationAttributeList(){
75 List<String> result = new ArrayList<String>();
76 result.add(destinationValue);
77 return result;
78 }
79
80 public abstract Class getTypeClass();
81 }