8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.nashorn.internal.runtime.options;
27
28 import java.util.TimeZone;
29 import jdk.nashorn.internal.runtime.QuotedStringTokenizer;
30
31 /**
32 * This describes the valid input for an option, as read from the resource
33 * bundle file. Metainfo such as parameters and description is here as well
34 * for context sensitive help generation.
35 */
36 public class OptionTemplate implements Comparable<OptionTemplate> {
37 /** Resource, e.g. "nashorn" for this option */
38 private final String resource;
39
40 /** Key in the resource bundle */
41 private final String key;
42
43 /** Is this option a help option? */
44 private final boolean isHelp;
45
46 /** Is this option a extended help option? */
47 private final boolean isXHelp;
246 break;
247 case "name":
248 if (!arg.startsWith("-")) {
249 throw new IllegalArgumentException(arg);
250 }
251 this.name = arg;
252 break;
253 case "short_name":
254 if (!arg.startsWith("-")) {
255 throw new IllegalArgumentException(arg);
256 }
257 this.shortName = arg;
258 break;
259 case "desc":
260 this.description = arg;
261 break;
262 case "params":
263 this.params = arg;
264 break;
265 case "type":
266 this.type = arg.toLowerCase();
267 break;
268 case "default":
269 this.defaultValue = arg;
270 break;
271 case "dependency":
272 this.dependency = arg;
273 break;
274 case "conflict":
275 this.conflict = arg;
276 break;
277 case "value_next_arg":
278 this.valueNextArg = Boolean.parseBoolean(arg);
279 break;
280 default:
281 throw new IllegalArgumentException(keyToken);
282 }
283 }
284
285 // default to boolean if no type is given
286 if (this.type == null) {
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.nashorn.internal.runtime.options;
27
28 import java.util.Locale;
29 import java.util.TimeZone;
30 import jdk.nashorn.internal.runtime.QuotedStringTokenizer;
31
32 /**
33 * This describes the valid input for an option, as read from the resource
34 * bundle file. Metainfo such as parameters and description is here as well
35 * for context sensitive help generation.
36 */
37 public class OptionTemplate implements Comparable<OptionTemplate> {
38 /** Resource, e.g. "nashorn" for this option */
39 private final String resource;
40
41 /** Key in the resource bundle */
42 private final String key;
43
44 /** Is this option a help option? */
45 private final boolean isHelp;
46
47 /** Is this option a extended help option? */
48 private final boolean isXHelp;
247 break;
248 case "name":
249 if (!arg.startsWith("-")) {
250 throw new IllegalArgumentException(arg);
251 }
252 this.name = arg;
253 break;
254 case "short_name":
255 if (!arg.startsWith("-")) {
256 throw new IllegalArgumentException(arg);
257 }
258 this.shortName = arg;
259 break;
260 case "desc":
261 this.description = arg;
262 break;
263 case "params":
264 this.params = arg;
265 break;
266 case "type":
267 this.type = arg.toLowerCase(Locale.ROOT);
268 break;
269 case "default":
270 this.defaultValue = arg;
271 break;
272 case "dependency":
273 this.dependency = arg;
274 break;
275 case "conflict":
276 this.conflict = arg;
277 break;
278 case "value_next_arg":
279 this.valueNextArg = Boolean.parseBoolean(arg);
280 break;
281 default:
282 throw new IllegalArgumentException(keyToken);
283 }
284 }
285
286 // default to boolean if no type is given
287 if (this.type == null) {
|