246 options == null || options.length == 0 || |
246 options == null || options.length == 0 || |
247 defaultOption < 0 || defaultOption >= options.length) |
247 defaultOption < 0 || defaultOption >= options.length) |
248 throw new IllegalArgumentException(); |
248 throw new IllegalArgumentException(); |
249 |
249 |
250 for (int i = 0; i < options.length; i++) { |
250 for (int i = 0; i < options.length; i++) { |
251 if (options[i] == null || options[i].length() == 0) |
251 if (options[i] == null || options[i].isEmpty()) |
252 throw new IllegalArgumentException(); |
252 throw new IllegalArgumentException(); |
253 } |
253 } |
254 |
254 |
255 this.messageType = messageType; |
255 this.messageType = messageType; |
256 this.options = options; |
256 this.options = options; |
292 * {@code optionType}. |
292 * {@code optionType}. |
293 */ |
293 */ |
294 public ConfirmationCallback(String prompt, int messageType, |
294 public ConfirmationCallback(String prompt, int messageType, |
295 int optionType, int defaultOption) { |
295 int optionType, int defaultOption) { |
296 |
296 |
297 if (prompt == null || prompt.length() == 0 || |
297 if (prompt == null || prompt.isEmpty() || |
298 messageType < INFORMATION || messageType > ERROR || |
298 messageType < INFORMATION || messageType > ERROR || |
299 optionType < YES_NO_OPTION || optionType > OK_CANCEL_OPTION) |
299 optionType < YES_NO_OPTION || optionType > OK_CANCEL_OPTION) |
300 throw new IllegalArgumentException(); |
300 throw new IllegalArgumentException(); |
301 |
301 |
302 switch (optionType) { |
302 switch (optionType) { |
355 * {@code options}. |
355 * {@code options}. |
356 */ |
356 */ |
357 public ConfirmationCallback(String prompt, int messageType, |
357 public ConfirmationCallback(String prompt, int messageType, |
358 String[] options, int defaultOption) { |
358 String[] options, int defaultOption) { |
359 |
359 |
360 if (prompt == null || prompt.length() == 0 || |
360 if (prompt == null || prompt.isEmpty() || |
361 messageType < INFORMATION || messageType > ERROR || |
361 messageType < INFORMATION || messageType > ERROR || |
362 options == null || options.length == 0 || |
362 options == null || options.length == 0 || |
363 defaultOption < 0 || defaultOption >= options.length) |
363 defaultOption < 0 || defaultOption >= options.length) |
364 throw new IllegalArgumentException(); |
364 throw new IllegalArgumentException(); |
365 |
365 |
366 for (int i = 0; i < options.length; i++) { |
366 for (int i = 0; i < options.length; i++) { |
367 if (options[i] == null || options[i].length() == 0) |
367 if (options[i] == null || options[i].isEmpty()) |
368 throw new IllegalArgumentException(); |
368 throw new IllegalArgumentException(); |
369 } |
369 } |
370 |
370 |
371 this.prompt = prompt; |
371 this.prompt = prompt; |
372 this.messageType = messageType; |
372 this.messageType = messageType; |