1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.morph.transform.copiers;
17
18 import java.util.Map;
19
20 import net.sf.morph.reflect.reflectors.MapReflector;
21
22 /**
23 * Copies one Map to another. A PropertyNameMatchingCopier can do this as well,
24 * but only for maps whose keys are Strings!
25 *
26 * @author mbenson
27 * @since Morph 1.1
28 */
29 public class MapCopier extends ContainerCopier {
30 private static final Class[] SOURCE_AND_DESTINATION_TYPES = { Map.class };
31
32 /**
33 * {@inheritDoc}
34 */
35 protected void initializeImpl() throws Exception {
36 super.initializeImpl();
37 setReflector(new MapReflector(MapReflector.EXTRACT_ENTRIES));
38 }
39
40 /**
41 * {@inheritDoc}
42 */
43 protected Class[] getSourceClassesImpl() throws Exception {
44 return SOURCE_AND_DESTINATION_TYPES;
45 }
46
47 /**
48 * {@inheritDoc}
49 */
50 protected Class[] getDestinationClassesImpl() throws Exception {
51 return SOURCE_AND_DESTINATION_TYPES;
52 }
53
54 }