257
258 try {
259 o.handleOption(helper, current, remaining);
260 } catch (Option.InvalidValueException e) {
261 throw new IllegalArgumentException(e.getMessage(), e);
262 }
263
264 return true;
265 }
266 // where
267 protected static final Set<Option> javacFileManagerOptions =
268 Option.getJavacFileManagerOptions();
269
270 @Override @DefinedBy(Api.COMPILER)
271 public int isSupportedOption(String option) {
272 Option o = Option.lookup(option, javacFileManagerOptions);
273 return (o == null) ? -1 : o.hasArg() ? 1 : 0;
274 }
275
276 protected String multiReleaseValue;
277
278 /**
279 * Common back end for OptionHelper handleFileManagerOption.
280 * @param option the option whose value to be set
281 * @param value the value for the option
282 * @return true if successful, and false otherwise
283 */
284 public boolean handleOption(Option option, String value) {
285 switch (option) {
286 case ENCODING:
287 encodingName = value;
288 return true;
289
290 case MULTIRELEASE:
291 multiReleaseValue = value;
292 locations.setMultiReleaseValue(value);
293 return true;
294
295 default:
296 return locations.handleOption(option, value);
297 }
298 }
299
300 /**
301 * Call handleOption for collection of options and corresponding values.
302 * @param map a collection of options and corresponding values
303 * @return true if all the calls are successful
304 */
305 public boolean handleOptions(Map<Option, String> map) {
306 boolean ok = true;
307 for (Map.Entry<Option, String> e: map.entrySet()) {
308 try {
309 ok = ok & handleOption(e.getKey(), e.getValue());
310 } catch (IllegalArgumentException ex) {
311 log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage()));
312 ok = false;
313 }
314 }
|
257
258 try {
259 o.handleOption(helper, current, remaining);
260 } catch (Option.InvalidValueException e) {
261 throw new IllegalArgumentException(e.getMessage(), e);
262 }
263
264 return true;
265 }
266 // where
267 protected static final Set<Option> javacFileManagerOptions =
268 Option.getJavacFileManagerOptions();
269
270 @Override @DefinedBy(Api.COMPILER)
271 public int isSupportedOption(String option) {
272 Option o = Option.lookup(option, javacFileManagerOptions);
273 return (o == null) ? -1 : o.hasArg() ? 1 : 0;
274 }
275
276 protected String multiReleaseValue;
277 protected boolean previewMode;
278
279 /**
280 * Common back end for OptionHelper handleFileManagerOption.
281 * @param option the option whose value to be set
282 * @param value the value for the option
283 * @return true if successful, and false otherwise
284 */
285 public boolean handleOption(Option option, String value) {
286 switch (option) {
287 case ENCODING:
288 encodingName = value;
289 return true;
290
291 case MULTIRELEASE:
292 multiReleaseValue = value;
293 locations.setMultiReleaseValue(value);
294 return true;
295
296 case PREVIEWMODE:
297 previewMode = Boolean.parseBoolean(value);
298 locations.setPreviewMode(previewMode);
299 return true;
300
301 default:
302 return locations.handleOption(option, value);
303 }
304 }
305
306 /**
307 * Call handleOption for collection of options and corresponding values.
308 * @param map a collection of options and corresponding values
309 * @return true if all the calls are successful
310 */
311 public boolean handleOptions(Map<Option, String> map) {
312 boolean ok = true;
313 for (Map.Entry<Option, String> e: map.entrySet()) {
314 try {
315 ok = ok & handleOption(e.getKey(), e.getValue());
316 } catch (IllegalArgumentException ex) {
317 log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage()));
318 ok = false;
319 }
320 }
|