-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WINDUP-1724 Reduce list {source,target,tag} commands execution time: …
…enhanced
- Loading branch information
Showing
5 changed files
with
46 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
.../src/main/java/org/jboss/windup/bootstrap/commands/AbstractListCommandWithoutFurnace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jboss.windup.bootstrap.commands; | ||
|
||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.windup.bootstrap.help.Help; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public abstract class AbstractListCommandWithoutFurnace implements Command | ||
{ | ||
/** | ||
* Print the given values after displaying the provided message. | ||
*/ | ||
protected static void printValuesSorted(String message, Set<String> values) | ||
{ | ||
System.out.println(); | ||
System.out.println(message + ":"); | ||
List<String> sorted = new ArrayList<>(values); | ||
Collections.sort(sorted); | ||
for (String value : sorted) | ||
{ | ||
System.out.println("\t" + value); | ||
} | ||
} | ||
|
||
protected static Set<String> getOptionValuesFromHelp(String optionName) | ||
{ | ||
Set<String> options = new HashSet<>(); | ||
Help.load().getOptions().stream() | ||
.filter(opt -> opt.getName().equals(optionName)) | ||
.forEach(optionDescription -> options.addAll(optionDescription.getAvailableOptions())); | ||
return options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters