@@ -506,7 +506,7 @@ public String[] getOptionValues(final String opt) {
506506 *
507507 * @param opt the name of the option.
508508 * @param <T> The return type for the method.
509- * @return the value parsed into a particular object.
509+ * @return the value parsed into a particular object or null if the option is not set .
510510 * @throws ParseException if there are problems turning the option value into the desired type
511511 * @see PatternOptionBuilder
512512 * @since 1.5.0
@@ -521,7 +521,7 @@ public <T> T getParsedOptionValue(final char opt) throws ParseException {
521521 * @param opt the name of the option.
522522 * @param defaultValue the default value to return if opt is not set.
523523 * @param <T> The return type for the method.
524- * @return the value parsed into a particular object.
524+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
525525 * @throws ParseException if there are problems turning the option value into the desired type
526526 * @see PatternOptionBuilder
527527 * @since 1.7.0
@@ -536,7 +536,7 @@ public <T> T getParsedOptionValue(final char opt, final Supplier<T> defaultValue
536536 * @param opt the name of the option.
537537 * @param defaultValue the default value to return if opt is not set.
538538 * @param <T> The return type for the method.
539- * @return the value parsed into a particular object.
539+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
540540 * @throws ParseException if there are problems turning the option value into the desired type
541541 * @see PatternOptionBuilder
542542 * @since 1.7.0
@@ -550,7 +550,7 @@ public <T> T getParsedOptionValue(final char opt, final T defaultValue) throws P
550550 *
551551 * @param option the option.
552552 * @param <T> The return type for the method.
553- * @return the value parsed into a particular object.
553+ * @return the value parsed into a particular object or null if the option is not set .
554554 * @throws ParseException if there are problems turning the option value into the desired type
555555 * @see PatternOptionBuilder
556556 * @since 1.5.0
@@ -565,7 +565,7 @@ public <T> T getParsedOptionValue(final Option option) throws ParseException {
565565 * @param option the option.
566566 * @param defaultValue the default value to return if opt is not set.
567567 * @param <T> The return type for the method.
568- * @return the value parsed into a particular object.
568+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
569569 * @throws ParseException if there are problems turning the option value into the desired type
570570 * @see PatternOptionBuilder
571571 * @since 1.7.0
@@ -592,7 +592,7 @@ public <T> T getParsedOptionValue(final Option option, final Supplier<T> default
592592 * @param option the option.
593593 * @param defaultValue the default value to return if opt is not set.
594594 * @param <T> The return type for the method.
595- * @return the value parsed into a particular object.
595+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
596596 * @throws ParseException if there are problems turning the option value into the desired type
597597 * @see PatternOptionBuilder
598598 * @since 1.7.0
@@ -606,7 +606,7 @@ public <T> T getParsedOptionValue(final Option option, final T defaultValue) thr
606606 *
607607 * @param optionGroup the option group.
608608 * @param <T> The return type for the method.
609- * @return the value parsed into a particular object.
609+ * @return the value parsed into a particular object or null if no option in the OptionGroup is set .
610610 * @throws ParseException if there are problems turning the selected option value into the desired type
611611 * @see PatternOptionBuilder
612612 * @since 1.9.0
@@ -621,7 +621,7 @@ public <T> T getParsedOptionValue(final OptionGroup optionGroup) throws ParseExc
621621 * @param optionGroup the option group.
622622 * @param defaultValue the default value to return if opt is not set.
623623 * @param <T> The return type for the method.
624- * @return the value parsed into a particular object.
624+ * @return the value parsed into a particular object or the defaultValue if no option in the OptionGroup is set .
625625 * @throws ParseException if there are problems turning the selected option value into the desired type
626626 * @see PatternOptionBuilder
627627 * @since 1.9.0
@@ -639,7 +639,7 @@ public <T> T getParsedOptionValue(final OptionGroup optionGroup, final Supplier<
639639 * @param optionGroup the option group.
640640 * @param defaultValue the default value to return if an option is not selected.
641641 * @param <T> The return type for the method.
642- * @return the value parsed into a particular object.
642+ * @return the value parsed into a particular object or the defaultValue if no option in the OptionGroup is set .
643643 * @throws ParseException if there are problems turning the option value into the desired type
644644 * @see PatternOptionBuilder
645645 * @since 1.9.0
@@ -653,7 +653,7 @@ public <T> T getParsedOptionValue(final OptionGroup optionGroup, final T default
653653 *
654654 * @param opt the name of the option.
655655 * @param <T> The return type for the method.
656- * @return the value parsed into a particular object.
656+ * @return the value parsed into a particular object or null if the option is not set .
657657 * @throws ParseException if there are problems turning the option value into the desired type
658658 * @see PatternOptionBuilder
659659 * @since 1.2
@@ -668,7 +668,7 @@ public <T> T getParsedOptionValue(final String opt) throws ParseException {
668668 * @param opt the name of the option.
669669 * @param defaultValue the default value to return if opt is not set.
670670 * @param <T> The return type for the method.
671- * @return the value parsed into a particular object.
671+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
672672 * @throws ParseException if there are problems turning the option value into the desired type
673673 * @see PatternOptionBuilder
674674 * @since 1.7.0
@@ -683,7 +683,7 @@ public <T> T getParsedOptionValue(final String opt, final Supplier<T> defaultVal
683683 * @param opt the name of the option.
684684 * @param defaultValue the default value to return if opt is not set.
685685 * @param <T> The return type for the method.
686- * @return the value parsed into a particular object.
686+ * @return the value parsed into a particular object or the defaultValue if the option is not set .
687687 * @throws ParseException if there are problems turning the option value into the desired type
688688 * @see PatternOptionBuilder
689689 * @since 1.7.0
@@ -697,7 +697,7 @@ public <T> T getParsedOptionValue(final String opt, final T defaultValue) throws
697697 *
698698 * @param opt the name of the option.
699699 * @param <T> The array type for the return value.
700- * @return the values parsed into an array of objects.
700+ * @return the values parsed into an array of objects or null if the option is not set .
701701 * @throws ParseException if there are problems turning the option value into the desired type
702702 * @see PatternOptionBuilder
703703 * @since 1.10.0
@@ -712,7 +712,7 @@ public <T> T[] getParsedOptionValues(final char opt) throws ParseException {
712712 * @param opt the name of the option.
713713 * @param defaultValue the default value to return if opt is not set.
714714 * @param <T> The array type for the return value.
715- * @return the values parsed into an array of objects.
715+ * @return the values parsed into an array of objects or the defaultValue if the option is not set .
716716 * @throws ParseException if there are problems turning the option value into the desired type
717717 * @see PatternOptionBuilder
718718 * @since 1.10.0
@@ -727,7 +727,7 @@ public <T> T[] getParsedOptionValues(final char opt, final Supplier<T[]> default
727727 * @param opt the name of the option.
728728 * @param defaultValue the default value to return if opt is not set.
729729 * @param <T> The array type for the return value.
730- * @return the values parsed into an array of objects.
730+ * @return the values parsed into an array of objects or the defaultValue if the option is not set .
731731 * @throws ParseException if there are problems turning the option value into the desired type
732732 * @see PatternOptionBuilder
733733 * @since 1.10.0
@@ -741,7 +741,7 @@ public <T> T[] getParsedOptionValues(final char opt, final T[] defaultValue) thr
741741 *
742742 * @param option the option.
743743 * @param <T> The array type for the return value.
744- * @return the values parsed into an array of objects.
744+ * @return the values parsed into an array of objects or null if the option is not set .
745745 * @throws ParseException if there are problems turning the option value into the desired type
746746 * @see PatternOptionBuilder
747747 * @since 1.10.0
@@ -756,7 +756,7 @@ public <T> T[] getParsedOptionValues(final Option option) throws ParseException
756756 * @param option the option.
757757 * @param defaultValue the default value to return if opt is not set.
758758 * @param <T> The array type for the return value.
759- * @return the values parsed into an array of objects.
759+ * @return the values parsed into an array of objects or the defaultValue if the option is not set .
760760 * @throws ParseException if there are problems turning the option value into the desired type
761761 * @see PatternOptionBuilder
762762 * @since 1.10.0
@@ -777,10 +777,14 @@ public <T> T[] getParsedOptionValues(final Option option, final Supplier<T[]> de
777777 result [i ] = clazz .cast (option .getConverter ().apply (values [i ]));
778778 }
779779 return result ;
780- } catch (Throwable t ) {
780+ } catch (final Error t ) {
781+ throw t ;
782+ } catch (final Exception t ) {
781783 throw ParseException .wrap (t );
784+ } catch (final Throwable t ) {
785+ // this should not be reached.
786+ throw new RuntimeException (t );
782787 }
783-
784788 }
785789
786790 /**
@@ -789,7 +793,7 @@ public <T> T[] getParsedOptionValues(final Option option, final Supplier<T[]> de
789793 * @param option the option.
790794 * @param defaultValue the default value to return if opt is not set.
791795 * @param <T> The array type for the return value.
792- * @return the values parsed into an array of objects.
796+ * @return the values parsed into an array of objects or the defaultValue if the option is not set .
793797 * @throws ParseException if there are problems turning the option value into the desired type
794798 * @see PatternOptionBuilder
795799 * @since 1.10.0
@@ -803,7 +807,7 @@ public <T> T[] getParsedOptionValues(final Option option, final T[] defaultValue
803807 *
804808 * @param optionGroup the option group.
805809 * @param <T> The array type for the return value.
806- * @return the values parsed into an array of objects.
810+ * @return the values parsed into an array of objects or null if no option in the OptionGroup is set .
807811 * @throws ParseException if there are problems turning the selected option value into the desired type
808812 * @see PatternOptionBuilder
809813 * @since 1.10.0
@@ -818,7 +822,7 @@ public <T> T[] getParsedOptionValues(final OptionGroup optionGroup) throws Parse
818822 * @param optionGroup the option group.
819823 * @param defaultValue the default value to return if opt is not set.
820824 * @param <T> The array type for the return value.
821- * @return the values parsed into an array of objects.
825+ * @return the values parsed into an array of objects or null if no option in the OptionGroup is set .
822826 * @throws ParseException if there are problems turning the selected option value into the desired type
823827 * @see PatternOptionBuilder
824828 * @since 1.10.0
@@ -836,7 +840,7 @@ public <T> T[] getParsedOptionValues(final OptionGroup optionGroup, final Suppli
836840 * @param optionGroup the option group.
837841 * @param defaultValue the default value to return if an option is not selected.
838842 * @param <T> The array type for the return value.
839- * @return the values parsed into an array of objects.
843+ * @return the values parsed into an array of objects or null if no option in the OptionGroup is set .
840844 * @throws ParseException if there are problems turning the option value into the desired type
841845 * @see PatternOptionBuilder
842846 * @since 1.10.0
@@ -850,7 +854,7 @@ public <T> T[] getParsedOptionValues(final OptionGroup optionGroup, final T[] de
850854 *
851855 * @param opt the name of the option.
852856 * @param <T> The array type for the return value.
853- * @return the values parsed into an array of objects.
857+ * @return the values parsed into an array of objects or null if the option is not set .
854858 * @throws ParseException if there are problems turning the option value into the desired type
855859 * @see PatternOptionBuilder
856860 * @since 1.10.0
@@ -865,7 +869,7 @@ public <T> T[] getParsedOptionValues(final String opt) throws ParseException {
865869 * @param opt the name of the option.
866870 * @param defaultValue the default value to return if opt is not set.
867871 * @param <T> The array type for the return value.
868- * @return the values parsed into an array of objects.
872+ * @return the values parsed into an array of objects or defaultValues if the option is not set .
869873 * @throws ParseException if there are problems turning the option value into the desired type
870874 * @see PatternOptionBuilder
871875 * @since 1.10.0
@@ -880,7 +884,7 @@ public <T> T[] getParsedOptionValues(final String opt, final Supplier<T[]> defau
880884 * @param opt the name of the option.
881885 * @param defaultValue the default value to return if opt is not set.
882886 * @param <T> The array type for the return value.
883- * @return the values parsed into an array of objects.
887+ * @return the values parsed into an array of objects or defaultValues if the option is not set .
884888 * @throws ParseException if there are problems turning the option value into the desired type
885889 * @see PatternOptionBuilder
886890 * @since 1.10.0
0 commit comments