|
1 | 1 | package com.g2forge.bulldozer.build.maven; |
2 | 2 |
|
3 | 3 | import java.nio.file.Path; |
4 | | -import java.util.Collection; |
5 | 4 | import java.util.List; |
6 | | -import java.util.stream.Collectors; |
7 | 5 | import java.util.stream.Stream; |
8 | 6 |
|
9 | 7 | import com.g2forge.alexandria.java.core.helpers.HCollection; |
10 | 8 | import com.g2forge.alexandria.java.core.helpers.HStream; |
11 | 9 | import com.g2forge.gearbox.command.converter.IMethodArgument; |
12 | | -import com.g2forge.gearbox.command.converter.dumb.ArgumentRenderer; |
| 10 | +import com.g2forge.gearbox.command.converter.argumentrenderer.ASimpleArgumentRenderer; |
| 11 | +import com.g2forge.gearbox.command.converter.argumentrenderer.ArgumentRenderer; |
| 12 | +import com.g2forge.gearbox.command.converter.argumentrenderer.CSVArgumentRenderer; |
13 | 13 | import com.g2forge.gearbox.command.converter.dumb.Command; |
14 | 14 | import com.g2forge.gearbox.command.converter.dumb.Constant; |
15 | 15 | import com.g2forge.gearbox.command.converter.dumb.Flag; |
16 | | -import com.g2forge.gearbox.command.converter.dumb.HDumbCommandConverter; |
17 | | -import com.g2forge.gearbox.command.converter.dumb.IArgumentRenderer; |
18 | 16 | import com.g2forge.gearbox.command.converter.dumb.Named; |
19 | 17 | import com.g2forge.gearbox.command.converter.dumb.Working; |
20 | 18 | import com.g2forge.gearbox.command.proxy.method.ICommandInterface; |
21 | 19 |
|
22 | 20 | public interface IMaven extends ICommandInterface { |
23 | | - public static class CSVArgumentRenderer implements IArgumentRenderer<Object> { |
| 21 | + public static class SnapshotArgumentRenderer extends ASimpleArgumentRenderer<Boolean> { |
24 | 22 | @Override |
25 | | - public List<String> render(IMethodArgument<Object> argument) { |
26 | | - final Stream<String> stream; |
27 | | - final Object value = argument.get(); |
28 | | - if (value instanceof String[]) stream = Stream.of((String[]) value); |
29 | | - else { |
30 | | - @SuppressWarnings("unchecked") |
31 | | - final Collection<String> includes = (Collection<String>) value; |
32 | | - stream = includes.stream(); |
33 | | - } |
34 | | - final String string = stream.collect(Collectors.joining(",")); |
35 | | - if (string.isEmpty()) return HCollection.emptyList(); |
36 | | - return HDumbCommandConverter.computeString(argument, string); |
37 | | - } |
38 | | - } |
39 | | - |
40 | | - public static class SnapshotArgumentRenderer implements IArgumentRenderer<Boolean> { |
41 | | - @Override |
42 | | - public List<String> render(IMethodArgument<Boolean> argument) { |
| 23 | + protected List<String> renderSimple(IMethodArgument<Boolean> argument) { |
43 | 24 | if (argument.get()) return HCollection.asList("versions:use-latest-snapshots", "-DallowSnapshots=true"); |
44 | 25 | return HCollection.asList("versions:use-latest-releases"); |
45 | 26 | } |
46 | 27 | } |
47 | 28 |
|
48 | | - public static class UpdateParentArgumentRenderer implements IArgumentRenderer<Boolean> { |
| 29 | + public static class UpdateParentArgumentRenderer extends ASimpleArgumentRenderer<Boolean> { |
49 | 30 | @Override |
50 | | - public List<String> render(IMethodArgument<Boolean> argument) { |
| 31 | + protected List<String> renderSimple(IMethodArgument<Boolean> argument) { |
51 | 32 | if (argument.get()) return HCollection.asList("versions:update-parent"); |
52 | 33 | return HCollection.emptyList(); |
53 | 34 | } |
|
0 commit comments