@@ -75,7 +75,7 @@ default Builder option(@NotNull Supplier<@NotNull Option<?>> optionSupplier) {
7575 * To add to another group, use {@link Builder#group(OptionGroup)}.
7676 * To construct an option, use {@link Option#createBuilder()}
7777 *
78- * @param condition only if true is the option added
78+ * @param condition whether to add the option
7979 * @return this
8080 */
8181 @ Override
@@ -89,8 +89,8 @@ default Builder optionIf(boolean condition, @NotNull Option<?> option) {
8989 * To add to another group, use {@link Builder#group(OptionGroup)}.
9090 * To construct an option, use {@link Option#createBuilder()}
9191 *
92- * @param condition only if true is the option added
93- * @param optionSupplier to be called to initialise the option. called immediately only if condition is true
92+ * @param condition whether to add the option
93+ * @param optionSupplier to be called to initialise the option. called immediately if and only if condition is true
9494 * @return this
9595 */
9696 @ Override
@@ -117,6 +117,40 @@ default Builder optionIf(boolean condition, @NotNull Supplier<@NotNull Option<?>
117117 */
118118 Builder group (@ NotNull OptionGroup group );
119119
120+ /**
121+ * Adds an option group.
122+ * To add an option to the root group, use {@link Builder#option(Option)}
123+ * To construct a group, use {@link OptionGroup#createBuilder()}
124+ *
125+ * @param groupSupplier to be called to initialise the group. called immediately
126+ */
127+ default Builder group (@ NotNull Supplier <@ NotNull OptionGroup > groupSupplier ) {
128+ return group (groupSupplier .get ());
129+ }
130+
131+ /**
132+ * Adds an option group if a condition is met.
133+ * To add an option to the root group, use {@link Builder#optionIf(boolean, Option)}.
134+ * To construct a group, use {@link OptionGroup#createBuilder()}
135+ *
136+ * @param condition whether to add the group
137+ */
138+ default Builder groupIf (boolean condition , @ NotNull OptionGroup group ) {
139+ return condition ? group (group ) : this ;
140+ }
141+
142+ /**
143+ * Adds an option group if a condition is met.
144+ * To add an option to the root group, use {@link Builder#optionIf(boolean, Option)}.
145+ * To construct a group, use {@link OptionGroup#createBuilder()}
146+ *
147+ * @param condition whether to add the group
148+ * @param groupSupplier to be called to initialise the group. called immediately if and only if condition is true
149+ */
150+ default Builder groupIf (boolean condition , @ NotNull Supplier <@ NotNull OptionGroup > groupSupplier ) {
151+ return condition ? group (groupSupplier ) : this ;
152+ }
153+
120154 /**
121155 * Adds multiple option groups.
122156 * To add multiple options to the root group, use {@link Builder#options(Collection)}
0 commit comments