1919public class CliArguments {
2020 private static final Path EMPTY_PATH = Paths .get ("" );
2121
22- private final Path outputFilePath ;
23- private final Path assetsFilePath ;
24- private final LocalDateTime sinceDate ;
25- private final LocalDateTime untilDate ;
26- private final boolean isSinceDateProvided ;
27- private final boolean isUntilDateProvided ;
28- private final List <FileType > formats ;
29- private final boolean isLastModifiedDateIncluded ;
30- private final boolean isShallowCloningPerformed ;
31- private final boolean isAutomaticallyLaunching ;
32- private final boolean isStandaloneConfigIgnored ;
33- private final boolean isFileSizeLimitIgnored ;
34- private final int numCloningThreads ;
35- private final int numAnalysisThreads ;
36- private final ZoneId zoneId ;
37- private final boolean isFindingPreviousAuthorsPerformed ;
22+ private Path outputFilePath ;
23+ private Path assetsFilePath ;
24+ private LocalDateTime sinceDate ;
25+ private LocalDateTime untilDate ;
26+ private boolean isSinceDateProvided ;
27+ private boolean isUntilDateProvided ;
28+ private List <FileType > formats ;
29+ private boolean isLastModifiedDateIncluded ;
30+ private boolean isShallowCloningPerformed ;
31+ private boolean isAutomaticallyLaunching ;
32+ private boolean isStandaloneConfigIgnored ;
33+ private boolean isFileSizeLimitIgnored ;
34+ private int numCloningThreads ;
35+ private int numAnalysisThreads ;
36+ private ZoneId zoneId ;
37+ private boolean isFindingPreviousAuthorsPerformed ;
3838 private boolean isTestMode = ArgsParser .DEFAULT_IS_TEST_MODE ;
3939 private boolean isFreshClonePerformed = ArgsParser .DEFAULT_SHOULD_FRESH_CLONE ;
4040
41-
4241 private List <String > locations ;
4342 private boolean isViewModeOnly ;
4443
@@ -51,35 +50,10 @@ public class CliArguments {
5150 private Path reportConfigFilePath ;
5251 private ReportConfiguration reportConfiguration ;
5352
54- private CliArguments (Builder builder ) {
55- this .outputFilePath = builder .outputFilePath ;
56- this .assetsFilePath = builder .assetsFilePath ;
57- this .sinceDate = builder .sinceDate ;
58- this .untilDate = builder .untilDate ;
59- this .isSinceDateProvided = builder .isSinceDateProvided ;
60- this .isUntilDateProvided = builder .isUntilDateProvided ;
61- this .formats = builder .formats ;
62- this .isLastModifiedDateIncluded = builder .isLastModifiedDateIncluded ;
63- this .isShallowCloningPerformed = builder .isShallowCloningPerformed ;
64- this .isAutomaticallyLaunching = builder .isAutomaticallyLaunching ;
65- this .isStandaloneConfigIgnored = builder .isStandaloneConfigIgnored ;
66- this .isFileSizeLimitIgnored = builder .isFileSizeLimitIgnored ;
67- this .numCloningThreads = builder .numCloningThreads ;
68- this .numAnalysisThreads = builder .numAnalysisThreads ;
69- this .zoneId = builder .zoneId ;
70- this .isFindingPreviousAuthorsPerformed = builder .isFindingPreviousAuthorsPerformed ;
71- this .isTestMode = builder .isTestMode ;
72- this .isFreshClonePerformed = builder .isFreshClonePerformed ;
73- this .locations = builder .locations ;
74- this .isViewModeOnly = builder .isViewModeOnly ;
75- this .reportDirectoryPath = builder .reportDirectoryPath ;
76- this .configFolderPath = builder .configFolderPath ;
77- this .repoConfigFilePath = builder .repoConfigFilePath ;
78- this .authorConfigFilePath = builder .authorConfigFilePath ;
79- this .groupConfigFilePath = builder .groupConfigFilePath ;
80- this .reportConfigFilePath = builder .reportConfigFilePath ;
81- this .reportConfiguration = builder .reportConfiguration ;
82- }
53+ /**
54+ * Constructs a {@code CliArguments} object without any parameters.
55+ */
56+ private CliArguments () {}
8357
8458 public ZoneId getZoneId () {
8559 return zoneId ;
@@ -233,35 +207,10 @@ public boolean equals(Object other) {
233207 * Builder used to build CliArguments.
234208 */
235209 public static final class Builder {
236- private Path outputFilePath ;
237- private Path assetsFilePath ;
238- private LocalDateTime sinceDate ;
239- private LocalDateTime untilDate ;
240- private boolean isSinceDateProvided ;
241- private boolean isUntilDateProvided ;
242- private List <FileType > formats ;
243- private boolean isLastModifiedDateIncluded ;
244- private boolean isShallowCloningPerformed ;
245- private boolean isAutomaticallyLaunching ;
246- private boolean isStandaloneConfigIgnored ;
247- private boolean isFileSizeLimitIgnored ;
248- private int numCloningThreads ;
249- private int numAnalysisThreads ;
250- private ZoneId zoneId ;
251- private boolean isFindingPreviousAuthorsPerformed ;
252- private boolean isTestMode ;
253- private boolean isFreshClonePerformed ;
254- private List <String > locations ;
255- private boolean isViewModeOnly ;
256- private Path reportDirectoryPath ;
257- private Path configFolderPath ;
258- private Path repoConfigFilePath ;
259- private Path authorConfigFilePath ;
260- private Path groupConfigFilePath ;
261- private Path reportConfigFilePath ;
262- private ReportConfiguration reportConfiguration ;
210+ private CliArguments cliArguments ;
263211
264212 public Builder () {
213+ this .cliArguments = new CliArguments ();
265214 }
266215
267216 /**
@@ -270,7 +219,7 @@ public Builder() {
270219 * @param outputFilePath The output file path.
271220 */
272221 public Builder outputFilePath (Path outputFilePath ) {
273- this .outputFilePath = outputFilePath ;
222+ this .cliArguments . outputFilePath = outputFilePath ;
274223 return this ;
275224 }
276225
@@ -280,7 +229,7 @@ public Builder outputFilePath(Path outputFilePath) {
280229 * @param assetsFilePath The assets file path.
281230 */
282231 public Builder assetsFilePath (Path assetsFilePath ) {
283- this .assetsFilePath = assetsFilePath ;
232+ this .cliArguments . assetsFilePath = assetsFilePath ;
284233 return this ;
285234 }
286235
@@ -290,7 +239,7 @@ public Builder assetsFilePath(Path assetsFilePath) {
290239 * @param sinceDate The since date.
291240 */
292241 public Builder sinceDate (LocalDateTime sinceDate ) {
293- this .sinceDate = sinceDate ;
242+ this .cliArguments . sinceDate = sinceDate ;
294243 return this ;
295244 }
296245
@@ -300,7 +249,7 @@ public Builder sinceDate(LocalDateTime sinceDate) {
300249 * @param untilDate The until date.
301250 */
302251 public Builder untilDate (LocalDateTime untilDate ) {
303- this .untilDate = untilDate ;
252+ this .cliArguments . untilDate = untilDate ;
304253 return this ;
305254 }
306255
@@ -310,7 +259,7 @@ public Builder untilDate(LocalDateTime untilDate) {
310259 * @param isSinceDateProvided Is the since date provided.
311260 */
312261 public Builder isSinceDateProvided (boolean isSinceDateProvided ) {
313- this .isSinceDateProvided = isSinceDateProvided ;
262+ this .cliArguments . isSinceDateProvided = isSinceDateProvided ;
314263 return this ;
315264 }
316265
@@ -320,7 +269,7 @@ public Builder isSinceDateProvided(boolean isSinceDateProvided) {
320269 * @param isUntilDateProvided Is the until date provided.
321270 */
322271 public Builder isUntilDateProvided (boolean isUntilDateProvided ) {
323- this .isUntilDateProvided = isUntilDateProvided ;
272+ this .cliArguments . isUntilDateProvided = isUntilDateProvided ;
324273 return this ;
325274 }
326275
@@ -330,7 +279,7 @@ public Builder isUntilDateProvided(boolean isUntilDateProvided) {
330279 * @param formats The list of {@link FileType}.
331280 */
332281 public Builder formats (List <FileType > formats ) {
333- this .formats = formats ;
282+ this .cliArguments . formats = formats ;
334283 return this ;
335284 }
336285
@@ -340,7 +289,7 @@ public Builder formats(List<FileType> formats) {
340289 * @param isLastModifiedDateIncluded Is the last modified date included.
341290 */
342291 public Builder isLastModifiedDateIncluded (boolean isLastModifiedDateIncluded ) {
343- this .isLastModifiedDateIncluded = isLastModifiedDateIncluded ;
292+ this .cliArguments . isLastModifiedDateIncluded = isLastModifiedDateIncluded ;
344293 return this ;
345294 }
346295
@@ -350,7 +299,7 @@ public Builder isLastModifiedDateIncluded(boolean isLastModifiedDateIncluded) {
350299 * @param isShallowCloningPerformed Is shallow cloning performed.
351300 */
352301 public Builder isShallowCloningPerformed (boolean isShallowCloningPerformed ) {
353- this .isShallowCloningPerformed = isShallowCloningPerformed ;
302+ this .cliArguments . isShallowCloningPerformed = isShallowCloningPerformed ;
354303 return this ;
355304 }
356305
@@ -360,7 +309,7 @@ public Builder isShallowCloningPerformed(boolean isShallowCloningPerformed) {
360309 * @param isAutomaticallyLaunching Is automatically launching.
361310 */
362311 public Builder isAutomaticallyLaunching (boolean isAutomaticallyLaunching ) {
363- this .isAutomaticallyLaunching = isAutomaticallyLaunching ;
312+ this .cliArguments . isAutomaticallyLaunching = isAutomaticallyLaunching ;
364313 return this ;
365314 }
366315
@@ -370,7 +319,7 @@ public Builder isAutomaticallyLaunching(boolean isAutomaticallyLaunching) {
370319 * @param isStandaloneConfigIgnored Is standalone config ignored.
371320 */
372321 public Builder isStandaloneConfigIgnored (boolean isStandaloneConfigIgnored ) {
373- this .isStandaloneConfigIgnored = isStandaloneConfigIgnored ;
322+ this .cliArguments . isStandaloneConfigIgnored = isStandaloneConfigIgnored ;
374323 return this ;
375324 }
376325
@@ -380,7 +329,7 @@ public Builder isStandaloneConfigIgnored(boolean isStandaloneConfigIgnored) {
380329 * @param isFileSizeLimitIgnored Is file size limit ignored.
381330 */
382331 public Builder isFileSizeLimitIgnored (boolean isFileSizeLimitIgnored ) {
383- this .isFileSizeLimitIgnored = isFileSizeLimitIgnored ;
332+ this .cliArguments . isFileSizeLimitIgnored = isFileSizeLimitIgnored ;
384333 return this ;
385334 }
386335
@@ -390,7 +339,7 @@ public Builder isFileSizeLimitIgnored(boolean isFileSizeLimitIgnored) {
390339 * @param numCloningThreads The number of cloning threads.
391340 */
392341 public Builder numCloningThreads (int numCloningThreads ) {
393- this .numCloningThreads = numCloningThreads ;
342+ this .cliArguments . numCloningThreads = numCloningThreads ;
394343 return this ;
395344 }
396345
@@ -400,7 +349,7 @@ public Builder numCloningThreads(int numCloningThreads) {
400349 * @param numAnalysisThreads The number of analysis threads.
401350 */
402351 public Builder numAnalysisThreads (int numAnalysisThreads ) {
403- this .numAnalysisThreads = numAnalysisThreads ;
352+ this .cliArguments . numAnalysisThreads = numAnalysisThreads ;
404353 return this ;
405354 }
406355
@@ -410,7 +359,7 @@ public Builder numAnalysisThreads(int numAnalysisThreads) {
410359 * @param zoneId The timezone Id.
411360 */
412361 public Builder zoneId (ZoneId zoneId ) {
413- this .zoneId = zoneId ;
362+ this .cliArguments . zoneId = zoneId ;
414363 return this ;
415364 }
416365
@@ -420,7 +369,7 @@ public Builder zoneId(ZoneId zoneId) {
420369 * @param isFindingPreviousAuthorsPerformed Is finding previous authors performed.
421370 */
422371 public Builder isFindingPreviousAuthorsPerformed (boolean isFindingPreviousAuthorsPerformed ) {
423- this .isFindingPreviousAuthorsPerformed = isFindingPreviousAuthorsPerformed ;
372+ this .cliArguments . isFindingPreviousAuthorsPerformed = isFindingPreviousAuthorsPerformed ;
424373 return this ;
425374 }
426375
@@ -430,7 +379,7 @@ public Builder isFindingPreviousAuthorsPerformed(boolean isFindingPreviousAuthor
430379 * @param isTestMode Is test mode.
431380 */
432381 public Builder isTestMode (boolean isTestMode ) {
433- this .isTestMode = isTestMode ;
382+ this .cliArguments . isTestMode = isTestMode ;
434383 return this ;
435384 }
436385
@@ -440,7 +389,7 @@ public Builder isTestMode(boolean isTestMode) {
440389 * @param isFreshClonePerformed Is fresh clone performed.
441390 */
442391 public Builder isFreshClonePerformed (boolean isFreshClonePerformed ) {
443- this .isFreshClonePerformed = isFreshClonePerformed ;
392+ this .cliArguments . isFreshClonePerformed = isFreshClonePerformed ;
444393 return this ;
445394 }
446395
@@ -450,7 +399,7 @@ public Builder isFreshClonePerformed(boolean isFreshClonePerformed) {
450399 * @param locations The list of locations.
451400 */
452401 public Builder locations (List <String > locations ) {
453- this .locations = locations ;
402+ this .cliArguments . locations = locations ;
454403 return this ;
455404 }
456405
@@ -460,7 +409,7 @@ public Builder locations(List<String> locations) {
460409 * @param isViewModeOnly Is view mode only.
461410 */
462411 public Builder isViewModeOnly (boolean isViewModeOnly ) {
463- this .isViewModeOnly = isViewModeOnly ;
412+ this .cliArguments . isViewModeOnly = isViewModeOnly ;
464413 return this ;
465414 }
466415
@@ -470,7 +419,7 @@ public Builder isViewModeOnly(boolean isViewModeOnly) {
470419 * @param reportDirectoryPath The report directory path.
471420 */
472421 public Builder reportDirectoryPath (Path reportDirectoryPath ) {
473- this .reportDirectoryPath = reportDirectoryPath ;
422+ this .cliArguments . reportDirectoryPath = reportDirectoryPath ;
474423 return this ;
475424 }
476425
@@ -482,13 +431,17 @@ public Builder reportDirectoryPath(Path reportDirectoryPath) {
482431 * @param configFolderPath The config folder path.
483432 */
484433 public Builder configFolderPath (Path configFolderPath ) {
485- this .configFolderPath = configFolderPath .equals (EMPTY_PATH )
434+ this .cliArguments . configFolderPath = configFolderPath .equals (EMPTY_PATH )
486435 ? configFolderPath .toAbsolutePath ()
487436 : configFolderPath ;
488- this .repoConfigFilePath = configFolderPath .resolve (RepoConfigCsvParser .REPO_CONFIG_FILENAME );
489- this .authorConfigFilePath = configFolderPath .resolve (AuthorConfigCsvParser .AUTHOR_CONFIG_FILENAME );
490- this .groupConfigFilePath = configFolderPath .resolve (GroupConfigCsvParser .GROUP_CONFIG_FILENAME );
491- this .reportConfigFilePath = configFolderPath .resolve (ReportConfigJsonParser .REPORT_CONFIG_FILENAME );
437+ this .cliArguments .repoConfigFilePath = configFolderPath .resolve (
438+ RepoConfigCsvParser .REPO_CONFIG_FILENAME );
439+ this .cliArguments .authorConfigFilePath = configFolderPath .resolve (
440+ AuthorConfigCsvParser .AUTHOR_CONFIG_FILENAME );
441+ this .cliArguments .groupConfigFilePath = configFolderPath .resolve (
442+ GroupConfigCsvParser .GROUP_CONFIG_FILENAME );
443+ this .cliArguments .reportConfigFilePath = configFolderPath .resolve (
444+ ReportConfigJsonParser .REPORT_CONFIG_FILENAME );
492445 return this ;
493446 }
494447
@@ -498,7 +451,7 @@ public Builder configFolderPath(Path configFolderPath) {
498451 * @param reportConfiguration The report configuration.
499452 */
500453 public Builder reportConfiguration (ReportConfiguration reportConfiguration ) {
501- this .reportConfiguration = reportConfiguration ;
454+ this .cliArguments . reportConfiguration = reportConfiguration ;
502455 return this ;
503456 }
504457
@@ -508,7 +461,9 @@ public Builder reportConfiguration(ReportConfiguration reportConfiguration) {
508461 * @return CliArguments
509462 */
510463 public CliArguments build () {
511- return new CliArguments (this );
464+ CliArguments built = this .cliArguments ;
465+ this .cliArguments = new CliArguments ();
466+ return built ;
512467 }
513468 }
514469}
0 commit comments