Interface SingleItemSelectorSpec
- All Superinterfaces:
BaseInputSpec<SingleItemSelectorSpec>
- All Known Implementing Classes:
BaseSingleItemSelector,DefaultSingleInputSpec
Interface for single item selector spec builder.
-
Method Summary
Modifier and TypeMethodDescriptionand()Build and return parent builder.defaultSelect(String name) Automatically selects and exposes a given item.max(int max) Sets a maximum number of items in a selector list;Sets a name.next(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, String> next) Define a function which may return id of a next component to go.postHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Adds a post-run context handler.preHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Adds a pre-run context handler.renderer(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, List<org.jline.utils.AttributedString>> renderer) Sets a renderer function.resultMode(ResultMode resultMode) Sets a result mode.resultValue(String resultValue) Sets a result value.selectItem(String name, String item) Adds a select item.selectItems(Map<String, String> selectItems) Adds a map of select items.sort(Comparator<SelectorItem<String>> comparator) Sets aComparatorfor sorting items.storeResult(boolean store) Automatically stores result from aSingleItemSelector.SingleItemSelectorContextintoComponentContextwith key given to builder.Sets a default renderer template location.Methods inherited from interface org.springframework.shell.component.flow.BaseInputSpec
getThis, order
-
Method Details
-
name
Sets a name.- Parameters:
name- the name- Returns:
- a builder
-
resultValue
Sets a result value.- Parameters:
resultValue- the result value- Returns:
- a builder
-
resultMode
Sets a result mode.- Parameters:
resultMode- the result mode- Returns:
- a builder
-
selectItem
Adds a select item.- Parameters:
name- the nameitem- the item- Returns:
- a builder
-
selectItems
Adds a map of select items.- Parameters:
selectItems- the select items- Returns:
- a builder
-
defaultSelect
Automatically selects and exposes a given item.- Parameters:
name- the name- Returns:
- a builder
-
sort
Sets aComparatorfor sorting items.- Parameters:
comparator- the item comparator- Returns:
- a builder
-
renderer
SingleItemSelectorSpec renderer(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, List<org.jline.utils.AttributedString>> renderer) Sets a renderer function.- Parameters:
renderer- the renderer- Returns:
- a builder
-
template
Sets a default renderer template location.- Parameters:
location- the template location- Returns:
- a builder
-
max
Sets a maximum number of items in a selector list;- Parameters:
max- the maximum number of items- Returns:
- a builder
-
preHandler
SingleItemSelectorSpec preHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Adds a pre-run context handler.- Parameters:
handler- the context handler- Returns:
- a builder
-
postHandler
SingleItemSelectorSpec postHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Adds a post-run context handler.- Parameters:
handler- the context handler- Returns:
- a builder
-
storeResult
Automatically stores result from aSingleItemSelector.SingleItemSelectorContextintoComponentContextwith key given to builder. Defaults totrue.- Parameters:
store- the flag if storing result- Returns:
- a builder
-
next
SingleItemSelectorSpec next(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, String> next) Define a function which may return id of a next component to go. Returning anullor non existent id indicates that flow should stop.- Parameters:
next- next component function- Returns:
- a builder
-
and
ComponentFlow.Builder and()Build and return parent builder.- Returns:
- the parent builder
-