9
9
import rife .bld .operations .exceptions .ExitStatusException ;
10
10
11
11
import java .io .File ;
12
- import java .util .*;
12
+ import java .nio .file .Path ;
13
+ import java .util .ArrayList ;
14
+ import java .util .List ;
13
15
14
16
/**
15
17
* Generates Java sources from ANTLR grammars.
@@ -115,7 +117,7 @@ public void execute()
115
117
* @since 1.0
116
118
*/
117
119
public Antlr4Operation arguments (String ... arguments ) {
118
- arguments_ .addAll (Arrays . asList (arguments ));
120
+ arguments_ .addAll (List . of (arguments ));
119
121
return this ;
120
122
}
121
123
@@ -138,47 +140,147 @@ public Antlr4Operation arguments(List<String> arguments) {
138
140
*
139
141
* @param directories the source directories
140
142
* @return this operation instance
143
+ * @see #sourceDirectories(List)
141
144
* @since 1.0
142
145
*/
143
146
public Antlr4Operation sourceDirectories (File ... directories ) {
144
- return sourceDirectories (Arrays . asList (directories ));
147
+ return sourceDirectories (List . of (directories ));
145
148
}
146
149
147
150
/**
148
151
* Provides the source directories that will be used for the antlr operation.
149
152
*
150
153
* @param directories the source directories
151
154
* @return this operation instance
155
+ * @see #sourceDirectoriesPaths(List)
156
+ * @since 1.4
157
+ */
158
+ public Antlr4Operation sourceDirectories (Path ... directories ) {
159
+ return sourceDirectoriesPaths (List .of (directories ));
160
+ }
161
+
162
+ /**
163
+ * Provides the source directories that will be used for the antlr operation.
164
+ *
165
+ * @param directories the source directories
166
+ * @return this operation instance
167
+ * @see #sourceDirectoriesStrings(List)
168
+ * @since 1.4
169
+ */
170
+ public Antlr4Operation sourceDirectories (String ... directories ) {
171
+ return sourceDirectoriesStrings (List .of (directories ));
172
+ }
173
+
174
+ /**
175
+ * Provides the source directories that will be used for the antlr operation.
176
+ *
177
+ * @param directories the source directories
178
+ * @return this operation instance
179
+ * @see #sourceDirectories(File...)
152
180
* @since 1.0
153
181
*/
154
182
public Antlr4Operation sourceDirectories (List <File > directories ) {
155
183
sourceDirectories_ .addAll (directories );
156
184
return this ;
157
185
}
158
186
187
+ /**
188
+ * Provides the source directories that will be used for the antlr operation.
189
+ *
190
+ * @param directories the source directories
191
+ * @return this operation instance
192
+ * @see #sourceDirectories(Path...)
193
+ * @since 1.0
194
+ */
195
+ public Antlr4Operation sourceDirectoriesPaths (List <Path > directories ) {
196
+ return sourceDirectories (directories .stream ().map (Path ::toFile ).toList ());
197
+ }
198
+
199
+ /**
200
+ * Provides the source directories that will be used for the antlr operation.
201
+ *
202
+ * @param directories the source directories
203
+ * @return this operation instance
204
+ * @see #sourceDirectories(File...)
205
+ * @since 1.0
206
+ */
207
+ public Antlr4Operation sourceDirectoriesStrings (List <String > directories ) {
208
+ return sourceDirectories (directories .stream ().map (File ::new ).toList ());
209
+ }
210
+
159
211
/**
160
212
* Provides the source files that will be used for the antlr operation.
161
213
*
162
214
* @param files the source files
163
215
* @return this operation instance
216
+ * @see #sourceFiles(List)
164
217
* @since 1.0
165
218
*/
166
219
public Antlr4Operation sourceFiles (File ... files ) {
167
- return sourceFiles (Arrays .asList (files ));
220
+ return sourceFiles (List .of (files ));
221
+ }
222
+
223
+ /**
224
+ * Provides the source files that will be used for the antlr operation.
225
+ *
226
+ * @param files the source files
227
+ * @return this operation instance
228
+ * @see #sourceFilesPaths(List)
229
+ * @since 1.4
230
+ */
231
+ public Antlr4Operation sourceFiles (Path ... files ) {
232
+ return sourceFilesPaths (List .of (files ));
233
+ }
234
+
235
+ /**
236
+ * Provides the source files that will be used for the antlr operation.
237
+ *
238
+ * @param files the source files
239
+ * @return this operation instance
240
+ * @see #sourceFilesStrings(List)
241
+ * @since 1.4
242
+ */
243
+ public Antlr4Operation sourceFiles (String ... files ) {
244
+ return sourceFilesStrings (List .of (files ));
168
245
}
169
246
170
247
/**
171
248
* Provides the source files that will be used for the antlr operation.
172
249
*
173
250
* @param files the source files
174
251
* @return this operation instance
252
+ * @see #sourceFiles(File...)
175
253
* @since 1.0
176
254
*/
177
255
public Antlr4Operation sourceFiles (List <File > files ) {
178
256
sourceFiles_ .addAll (files );
179
257
return this ;
180
258
}
181
259
260
+ /**
261
+ * Provides the source files that will be used for the antlr operation.
262
+ *
263
+ * @param files the source files
264
+ * @return this operation instance
265
+ * @see #sourceFiles(Path...)
266
+ * @since 1.4
267
+ */
268
+ public Antlr4Operation sourceFilesPaths (List <Path > files ) {
269
+ return sourceFiles (files .stream ().map (Path ::toFile ).toList ());
270
+ }
271
+
272
+ /**
273
+ * Provides the source files that will be used for the antlr operation.
274
+ *
275
+ * @param files the source files
276
+ * @return this operation instance
277
+ * @see #sourceFiles(String...)
278
+ * @since 1.4
279
+ */
280
+ public Antlr4Operation sourceFilesStrings (List <String > files ) {
281
+ return sourceFiles (files .stream ().map (File ::new ).toList ());
282
+ }
283
+
182
284
/**
183
285
* Provides the output directory where all output is generated.
184
286
*
@@ -191,6 +293,28 @@ public Antlr4Operation outputDirectory(File directory) {
191
293
return this ;
192
294
}
193
295
296
+ /**
297
+ * Provides the output directory where all output is generated.
298
+ *
299
+ * @param directory the output directory
300
+ * @return this operation instance
301
+ * @since 1.4
302
+ */
303
+ public Antlr4Operation outputDirectory (Path directory ) {
304
+ return outputDirectory (directory .toFile ());
305
+ }
306
+
307
+ /**
308
+ * Provides the output directory where all output is generated.
309
+ *
310
+ * @param directory the output directory
311
+ * @return this operation instance
312
+ * @since 1.4
313
+ */
314
+ public Antlr4Operation outputDirectory (String directory ) {
315
+ return outputDirectory (new File (directory ));
316
+ }
317
+
194
318
/**
195
319
* Provides the location of grammars and tokens files.
196
320
*
@@ -203,6 +327,28 @@ public Antlr4Operation libDirectory(File directory) {
203
327
return this ;
204
328
}
205
329
330
+ /**
331
+ * Provides the location of grammars and tokens files.
332
+ *
333
+ * @param directory the lib directory
334
+ * @return this operation instance
335
+ * @since 1.4
336
+ */
337
+ public Antlr4Operation libDirectory (Path directory ) {
338
+ return libDirectory (directory .toFile ());
339
+ }
340
+
341
+ /**
342
+ * Provides the location of grammars and tokens files.
343
+ *
344
+ * @param directory the lib directory
345
+ * @return this operation instance
346
+ * @since 1.4
347
+ */
348
+ public Antlr4Operation libDirectory (String directory ) {
349
+ return libDirectory (new File (directory ));
350
+ }
351
+
206
352
/**
207
353
* Provides grammar file encoding; e.g., euc-jp.
208
354
*
@@ -365,4 +511,4 @@ public File outputDirectory() {
365
511
public File libDirectory () {
366
512
return libDirectory_ ;
367
513
}
368
- }
514
+ }
0 commit comments