Class BaseMultiItemSelector
java.lang.Object
org.springframework.shell.component.flow.BaseInput<MultiItemSelectorSpec>
org.springframework.shell.component.flow.BaseMultiItemSelector
- All Implemented Interfaces:
org.springframework.core.Ordered
,BaseInputSpec<MultiItemSelectorSpec>
,MultiItemSelectorSpec
- Direct Known Subclasses:
DefaultMultiInputSpec
public abstract class BaseMultiItemSelector
extends BaseInput<MultiItemSelectorSpec>
implements MultiItemSelectorSpec
Base impl for
MultiItemSelectorSpec
.-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionand()
Build and return parent builder.getName()
getNext()
Function<MultiItemSelector.MultiItemSelectorContext<String,
SelectorItem<String>>, List<org.jline.utils.AttributedString>> getThis()
Usual this trick to get typed child.boolean
max
(int max) Sets a maximum number of items in a selector list;Sets a name.Define a function which may return id of a next component to go.postHandler
(Consumer<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>> handler) Adds a post-run context handler.preHandler
(Consumer<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>> handler) Adds a pre-run context handler.renderer
(Function<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>, List<org.jline.utils.AttributedString>> renderer) Sets a renderer function.resultMode
(ResultMode resultMode) Sets a result mode.resultValues
(List<String> resultValues) Sets a result values.selectItems
(List<SelectItem> selectItems) Adds a list of select items.sort
(Comparator<SelectorItem<String>> comparator) Sets aComparator
for sorting items.storeResult
(boolean store) Automatically stores result from aMultiItemSelector.MultiItemSelectorContext
intoComponentContext
with key given to builder.Sets a default renderer template location.Methods inherited from class org.springframework.shell.component.flow.BaseInput
getBuilder, getId, getOrder, order, setOrder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.shell.component.flow.BaseInputSpec
order
-
Constructor Details
-
BaseMultiItemSelector
-
-
Method Details
-
name
Description copied from interface:MultiItemSelectorSpec
Sets a name.- Specified by:
name
in interfaceMultiItemSelectorSpec
- Parameters:
name
- the name- Returns:
- a builder
-
resultValues
Description copied from interface:MultiItemSelectorSpec
Sets a result values.- Specified by:
resultValues
in interfaceMultiItemSelectorSpec
- Parameters:
resultValues
- the result values- Returns:
- a builder
-
resultMode
Description copied from interface:MultiItemSelectorSpec
Sets a result mode.- Specified by:
resultMode
in interfaceMultiItemSelectorSpec
- Parameters:
resultMode
- the result mode- Returns:
- a builder
-
selectItems
Description copied from interface:MultiItemSelectorSpec
Adds a list of select items.- Specified by:
selectItems
in interfaceMultiItemSelectorSpec
- Parameters:
selectItems
- the select items- Returns:
- a builder
-
sort
Description copied from interface:MultiItemSelectorSpec
Sets aComparator
for sorting items.- Specified by:
sort
in interfaceMultiItemSelectorSpec
- Parameters:
comparator
- the item comparator- Returns:
- a builder
-
renderer
public MultiItemSelectorSpec renderer(Function<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>, List<org.jline.utils.AttributedString>> renderer) Description copied from interface:MultiItemSelectorSpec
Sets a renderer function.- Specified by:
renderer
in interfaceMultiItemSelectorSpec
- Parameters:
renderer
- the renderer- Returns:
- a builder
-
template
Description copied from interface:MultiItemSelectorSpec
Sets a default renderer template location.- Specified by:
template
in interfaceMultiItemSelectorSpec
- Parameters:
location
- the template location- Returns:
- a builder
-
max
Description copied from interface:MultiItemSelectorSpec
Sets a maximum number of items in a selector list;- Specified by:
max
in interfaceMultiItemSelectorSpec
- Parameters:
max
- the maximum number of items- Returns:
- a builder
-
preHandler
public MultiItemSelectorSpec preHandler(Consumer<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>> handler) Description copied from interface:MultiItemSelectorSpec
Adds a pre-run context handler.- Specified by:
preHandler
in interfaceMultiItemSelectorSpec
- Parameters:
handler
- the context handler- Returns:
- a builder
-
postHandler
public MultiItemSelectorSpec postHandler(Consumer<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>> handler) Description copied from interface:MultiItemSelectorSpec
Adds a post-run context handler.- Specified by:
postHandler
in interfaceMultiItemSelectorSpec
- Parameters:
handler
- the context handler- Returns:
- a builder
-
storeResult
Description copied from interface:MultiItemSelectorSpec
Automatically stores result from aMultiItemSelector.MultiItemSelectorContext
intoComponentContext
with key given to builder. Defaults totrue
.- Specified by:
storeResult
in interfaceMultiItemSelectorSpec
- Parameters:
store
- the flag if storing result- Returns:
- a builder
-
next
public MultiItemSelectorSpec next(Function<MultiItemSelector.MultiItemSelectorContext<String, SelectorItem<String>>, String> next) Description copied from interface:MultiItemSelectorSpec
Define a function which may return id of a next component to go. Returning anull
or non existent id indicates that flow should stop.- Specified by:
next
in interfaceMultiItemSelectorSpec
- Parameters:
next
- next component function- Returns:
- a builder
-
and
Description copied from interface:MultiItemSelectorSpec
Build and return parent builder.- Specified by:
and
in interfaceMultiItemSelectorSpec
- Returns:
- the parent builder
-
getThis
Description copied from interface:BaseInputSpec
Usual this trick to get typed child.- Specified by:
getThis
in interfaceBaseInputSpec<MultiItemSelectorSpec>
- Returns:
- a builder
-
getName
-
getResultValues
-
getResultMode
-
getSelectItems
-
getComparator
-
getRenderer
public Function<MultiItemSelector.MultiItemSelectorContext<String,SelectorItem<String>>, getRenderer()List<org.jline.utils.AttributedString>> -
getTemplateLocation
-
getMaxItems
-
getPreHandlers
public List<Consumer<MultiItemSelector.MultiItemSelectorContext<String,SelectorItem<String>>>> getPreHandlers() -
getPostHandlers
public List<Consumer<MultiItemSelector.MultiItemSelectorContext<String,SelectorItem<String>>>> getPostHandlers() -
isStoreResult
public boolean isStoreResult() -
getNext
public Function<MultiItemSelector.MultiItemSelectorContext<String,SelectorItem<String>>, getNext()String>
-