1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.codehaus.mojo.cobertura.tasks;
21
22 import net.sourceforge.cobertura.util.CommandLineBuilder;
23
24 import java.io.IOException;
25 import java.util.ArrayList;
26 import java.util.Iterator;
27 import java.util.List;
28
29
30
31
32
33
34 public class CommandLineArguments
35 {
36 private List<String> args;
37
38 private boolean useCommandsFile;
39
40
41
42
43 public CommandLineArguments()
44 {
45 this.args = new ArrayList<String>();
46 this.useCommandsFile = false;
47 }
48
49
50
51
52
53
54 public void addArg( String arg )
55 {
56 this.args.add( arg );
57 }
58
59
60
61
62
63
64
65 public void addArg( String arg1, String arg2 )
66 {
67 this.args.add( arg1 );
68 this.args.add( arg2 );
69 }
70
71
72
73
74 public List<String> getArgs()
75 {
76 return this.args;
77 }
78
79
80
81
82
83
84
85 public String getCommandsFile()
86 throws IOException
87 {
88 CommandLineBuilder builder = new CommandLineBuilder();
89 for ( String arg : this.args )
90 {
91 builder.addArg( arg );
92 }
93 builder.saveArgs();
94 return builder.getCommandLineFile();
95 }
96
97
98
99
100 public Iterator<String> iterator()
101 {
102 return this.args.iterator();
103 }
104
105
106
107
108 public void setUseCommandsFile( boolean useCommandsFile )
109 {
110 this.useCommandsFile = useCommandsFile;
111 }
112
113
114
115
116 public boolean useCommandsFile()
117 {
118 return useCommandsFile;
119 }
120 }