@@ -16,18 +16,7 @@ class CommandChain {
1616 private static final Logger LOGGER = LoggerFactory .getLogger (CommandChain .class );
1717
1818 /** Internal ArrayList of the Commands */
19- private List <Command > commandList ;
20-
21- private static List <Command > COMMON_COMMANDS =
22- List .of (
23- // Validation commands
24- CheckDependencyPresent .getInstance (),
25- CheckParentPackaging .getInstance (),
26- // Format commands
27- new FormatCommand (),
28- new DiscardFormatCommand (),
29- // Multipom command
30- new CompositeDependencyManagement ());
19+ private final List <Command > commandList ;
3120
3221 private CommandChain (List <Command > commands ) {
3322 this .commandList = commands ;
@@ -93,7 +82,17 @@ public boolean execute(ProjectModel c)
9382 * @return A pre-configured Chain for modifying a POM.
9483 */
9584 public static CommandChain modifyDependency () {
96- final List <Command > modifyCommands = new ArrayList <>(COMMON_COMMANDS );
85+ final List <Command > modifyCommands =
86+ new ArrayList <>(
87+ List .of (
88+ // Validation commands
89+ CheckDependencyPresent .getInstance (),
90+ CheckParentPackaging .getInstance (),
91+ // Format commands
92+ new FormatCommand (),
93+ new DiscardFormatCommand (),
94+ // Multipom command
95+ new CompositeDependencyManagement ()));
9796 modifyCommands .addAll (
9897 List .of (
9998 SimpleUpgrade .getInstance (),
@@ -109,7 +108,17 @@ public static CommandChain modifyDependency() {
109108 * @return A pre-configured Chain.
110109 */
111110 public static CommandChain insertDependency () {
112- final List <Command > insertCommands = new ArrayList <>(COMMON_COMMANDS );
111+ final List <Command > insertCommands =
112+ new ArrayList <>(
113+ List .of (
114+ // Validation commands
115+ CheckDependencyPresent .getInstance (),
116+ CheckParentPackaging .getInstance (),
117+ // Format commands
118+ new FormatCommand (),
119+ new DiscardFormatCommand (),
120+ // Multipom command
121+ new CompositeDependencyManagement ()));
113122 insertCommands .add (new SimpleInsert (true ));
114123 return new CommandChain (insertCommands );
115124 }
@@ -120,7 +129,17 @@ public static CommandChain insertDependency() {
120129 * @return A pre-configured Chain.
121130 */
122131 public static CommandChain updateDependency () {
123- final List <Command > insertCommands = new ArrayList <>(COMMON_COMMANDS );
132+ final List <Command > insertCommands =
133+ new ArrayList <>(
134+ List .of (
135+ // Validation commands
136+ CheckDependencyPresent .getInstance (),
137+ CheckParentPackaging .getInstance (),
138+ // Format commands
139+ new FormatCommand (),
140+ new DiscardFormatCommand (),
141+ // Multipom command
142+ new CompositeDependencyManagement ()));
124143 insertCommands .addAll (
125144 List .of (SimpleUpgrade .getInstance (), SimpleDependencyManagement .getInstance ()));
126145
@@ -169,7 +188,8 @@ public static CommandChain createForDependencyQuery(QueryType queryType) {
169188 return filterByQueryType (
170189 AVAILABLE_DEPENDENCY_QUERY_COMMANDS ,
171190 queryType ,
172- Arrays .asList (CheckLocalRepositoryDirCommand .CheckParentDirCommand .getInstance ()),
191+ Collections .singletonList (
192+ CheckLocalRepositoryDirCommand .CheckParentDirCommand .getInstance ()),
173193 it -> it == queryType );
174194 }
175195
@@ -196,7 +216,7 @@ public static CommandChain createForVersionQuery(QueryType queryType) {
196216 * and report issues creating
197217 */
198218 static final List <Pair <QueryType , String >> AVAILABLE_DEPENDENCY_QUERY_COMMANDS =
199- new ArrayList <>(Arrays . asList (new Pair <>(QueryType .SAFE , "QueryByParsing" )));
219+ new ArrayList <>(List . of (new Pair <>(QueryType .SAFE , "QueryByParsing" )));
200220
201221 /** List of Commands for Version Query */
202222 private static final List <Pair <QueryType , String >> AVAILABLE_QUERY_VERSION_COMMANDS =
0 commit comments