src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
branchJDK-8200758-branch
changeset 57276 eac9018748b3
parent 57261 13b6672477df
child 57291 f2d429260ad4
equal deleted inserted replaced
57269:d28d38406872 57276:eac9018748b3
   122     private List<AddLauncherArguments> addLaunchers = null;
   122     private List<AddLauncherArguments> addLaunchers = null;
   123 
   123 
   124     private static Map<String, CLIOptions> argIds = new HashMap<>();
   124     private static Map<String, CLIOptions> argIds = new HashMap<>();
   125     private static Map<String, CLIOptions> argShortIds = new HashMap<>();
   125     private static Map<String, CLIOptions> argShortIds = new HashMap<>();
   126 
   126 
   127     {
   127     static {
   128         // init maps for parsing arguments
   128         // init maps for parsing arguments
   129         EnumSet<CLIOptions> options = EnumSet.allOf(CLIOptions.class);
   129         (EnumSet.allOf(CLIOptions.class)).forEach(option -> {
   130 
       
   131         options.forEach(option -> {
       
   132             argIds.put(option.getIdWithPrefix(), option);
   130             argIds.put(option.getIdWithPrefix(), option);
   133             if (option.getShortIdWithPrefix() != null) {
   131             if (option.getShortIdWithPrefix() != null) {
   134                 argShortIds.put(option.getShortIdWithPrefix(), option);
   132                 argShortIds.put(option.getShortIdWithPrefix(), option);
   135             }
   133             }
   136         });
   134         });
   137     }
   135     }
   138 
   136 
   139     public Arguments(String[] args) throws PackagerException {
   137     public Arguments(String[] args) throws PackagerException {
   140         initArgumentList(args);
   138         argList = new ArrayList<String>(args.length);
       
   139         for (String arg : args) {
       
   140             argList.add(arg);
       
   141         }
       
   142         Log.debug ("\njpackage argument list: \n" + argList + "\n");
       
   143         pos = 0;
       
   144 
       
   145         deployParams = new DeployParams();
       
   146         bundleType = BundlerType.NONE;
       
   147 
       
   148         allOptions = new ArrayList<>();
       
   149 
       
   150         addLaunchers = new ArrayList<>();
   141     }
   151     }
   142 
   152 
   143     // CLIOptions is public for DeployParamsTest
   153     // CLIOptions is public for DeployParamsTest
   144     public enum CLIOptions {
   154     public enum CLIOptions {
   145         CREATE_IMAGE(IMAGE_MODE, OptionCategories.MODE, () -> {
   155         CREATE_IMAGE(IMAGE_MODE, OptionCategories.MODE, () -> {
   470         MODULAR,
   480         MODULAR,
   471         PROPERTY,
   481         PROPERTY,
   472         PLATFORM_MAC,
   482         PLATFORM_MAC,
   473         PLATFORM_WIN,
   483         PLATFORM_WIN,
   474         PLATFORM_LINUX;
   484         PLATFORM_LINUX;
   475     }
       
   476 
       
   477     private void initArgumentList(String[] args) throws PackagerException {
       
   478         argList = new ArrayList<String>(args.length);
       
   479         for (String arg : args) {
       
   480             argList.add(arg);
       
   481         }
       
   482         Log.debug ("\njpackage argument list: \n" + argList + "\n");
       
   483         pos = 0;
       
   484 
       
   485         deployParams = new DeployParams();
       
   486         bundleType = BundlerType.NONE;
       
   487 
       
   488         allOptions = new ArrayList<>();
       
   489 
       
   490         addLaunchers = new ArrayList<>();
       
   491     }
   485     }
   492 
   486 
   493     public boolean processArguments() throws Exception {
   487     public boolean processArguments() throws Exception {
   494         try {
   488         try {
   495 
   489