1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.codehaus.mojo.castor;
17
18 import java.util.Iterator;
19 import java.util.Map;
20
21 import org.apache.maven.plugin.MojoExecutionException;
22 import org.apache.maven.plugin.MojoFailureException;
23 import org.apache.maven.plugins.annotations.Parameter;
24
25
26
27
28
29
30
31
32
33 public class MappingsMojo
34 extends AbstractMappingMojo
35 {
36
37
38
39 @Parameter(property = "classes", required = true)
40 private Map<String, String> classes;
41
42
43
44
45 private String className;
46
47
48
49
50 private String mappingName;
51
52
53
54
55
56
57 public void execute()
58 throws MojoExecutionException, MojoFailureException
59 {
60 if ( classes.isEmpty() )
61 {
62 getLog().warn( "No mapping set" );
63 }
64
65 for ( Iterator<Map.Entry<String, String>> iterator = classes.entrySet().iterator(); iterator.hasNext(); )
66 {
67 Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next();
68 className = (String) entry.getKey();
69 mappingName = (String) entry.getValue();
70 super.execute();
71 }
72 }
73
74
75
76
77
78
79 protected String getClassName()
80 {
81 return className;
82 }
83
84
85
86
87
88
89 protected String getMappingName()
90 {
91 return mappingName;
92 }
93 }