Class BaseSingleItemSelector
java.lang.Object
org.springframework.shell.component.flow.BaseInput<SingleItemSelectorSpec>
org.springframework.shell.component.flow.BaseSingleItemSelector
- All Implemented Interfaces:
org.springframework.core.Ordered
,BaseInputSpec<SingleItemSelectorSpec>
,SingleItemSelectorSpec
- Direct Known Subclasses:
DefaultSingleInputSpec
public abstract class BaseSingleItemSelector
extends BaseInput<SingleItemSelectorSpec>
implements SingleItemSelectorSpec
Base impl for
SingleItemSelectorSpec
.-
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.defaultSelect
(String name) Automatically selects and exposes a given item.getName()
getNext()
Function<SingleItemSelector.SingleItemSelectorContext<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.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
(List<SelectItem> selectItems) Adds a list of select items.selectItems
(Map<String, String> selectItems) Adds a map of select items.sort
(Comparator<SelectorItem<String>> comparator) Sets aComparator
for sorting items.storeResult
(boolean store) Automatically stores result from aSingleItemSelector.SingleItemSelectorContext
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
-
BaseSingleItemSelector
-
-
Method Details
-
name
Description copied from interface:SingleItemSelectorSpec
Sets a name.- Specified by:
name
in interfaceSingleItemSelectorSpec
- Parameters:
name
- the name- Returns:
- a builder
-
resultValue
Description copied from interface:SingleItemSelectorSpec
Sets a result value.- Specified by:
resultValue
in interfaceSingleItemSelectorSpec
- Parameters:
resultValue
- the result value- Returns:
- a builder
-
resultMode
Description copied from interface:SingleItemSelectorSpec
Sets a result mode.- Specified by:
resultMode
in interfaceSingleItemSelectorSpec
- Parameters:
resultMode
- the result mode- Returns:
- a builder
-
selectItem
Description copied from interface:SingleItemSelectorSpec
Adds a select item.- Specified by:
selectItem
in interfaceSingleItemSelectorSpec
- Parameters:
name
- the nameitem
- the item- Returns:
- a builder
- See Also:
-
selectItems
Description copied from interface:SingleItemSelectorSpec
Adds a map of select items.- Specified by:
selectItems
in interfaceSingleItemSelectorSpec
- Parameters:
selectItems
- the select items- Returns:
- a builder
- See Also:
-
selectItems
Description copied from interface:SingleItemSelectorSpec
Adds a list of select items.- Specified by:
selectItems
in interfaceSingleItemSelectorSpec
- Parameters:
selectItems
- the select items- Returns:
- a builder
-
defaultSelect
Description copied from interface:SingleItemSelectorSpec
Automatically selects and exposes a given item.- Specified by:
defaultSelect
in interfaceSingleItemSelectorSpec
- Parameters:
name
- the name- Returns:
- a builder
-
sort
Description copied from interface:SingleItemSelectorSpec
Sets aComparator
for sorting items.- Specified by:
sort
in interfaceSingleItemSelectorSpec
- Parameters:
comparator
- the item comparator- Returns:
- a builder
-
renderer
public SingleItemSelectorSpec renderer(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, List<org.jline.utils.AttributedString>> renderer) Description copied from interface:SingleItemSelectorSpec
Sets a renderer function.- Specified by:
renderer
in interfaceSingleItemSelectorSpec
- Parameters:
renderer
- the renderer- Returns:
- a builder
-
template
Description copied from interface:SingleItemSelectorSpec
Sets a default renderer template location.- Specified by:
template
in interfaceSingleItemSelectorSpec
- Parameters:
location
- the template location- Returns:
- a builder
-
max
Description copied from interface:SingleItemSelectorSpec
Sets a maximum number of items in a selector list;- Specified by:
max
in interfaceSingleItemSelectorSpec
- Parameters:
max
- the maximum number of items- Returns:
- a builder
-
preHandler
public SingleItemSelectorSpec preHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Description copied from interface:SingleItemSelectorSpec
Adds a pre-run context handler.- Specified by:
preHandler
in interfaceSingleItemSelectorSpec
- Parameters:
handler
- the context handler- Returns:
- a builder
-
postHandler
public SingleItemSelectorSpec postHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Description copied from interface:SingleItemSelectorSpec
Adds a post-run context handler.- Specified by:
postHandler
in interfaceSingleItemSelectorSpec
- Parameters:
handler
- the context handler- Returns:
- a builder
-
storeResult
Description copied from interface:SingleItemSelectorSpec
Automatically stores result from aSingleItemSelector.SingleItemSelectorContext
intoComponentContext
with key given to builder. Defaults totrue
.- Specified by:
storeResult
in interfaceSingleItemSelectorSpec
- Parameters:
store
- the flag if storing result- Returns:
- a builder
-
next
public SingleItemSelectorSpec next(Function<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>, String> next) Description copied from interface:SingleItemSelectorSpec
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 interfaceSingleItemSelectorSpec
- Parameters:
next
- next component function- Returns:
- a builder
-
and
Description copied from interface:SingleItemSelectorSpec
Build and return parent builder.- Specified by:
and
in interfaceSingleItemSelectorSpec
- Returns:
- the parent builder
-
getThis
Description copied from interface:BaseInputSpec
Usual this trick to get typed child.- Specified by:
getThis
in interfaceBaseInputSpec<SingleItemSelectorSpec>
- Returns:
- a builder
-
getName
-
getResultValue
-
getResultMode
-
getSelectItems
-
getDefaultSelect
-
getComparator
-
getRenderer
public Function<SingleItemSelector.SingleItemSelectorContext<String,SelectorItem<String>>, getRenderer()List<org.jline.utils.AttributedString>> -
getTemplateLocation
-
getMaxItems
-
getPreHandlers
public List<Consumer<SingleItemSelector.SingleItemSelectorContext<String,SelectorItem<String>>>> getPreHandlers() -
getPostHandlers
public List<Consumer<SingleItemSelector.SingleItemSelectorContext<String,SelectorItem<String>>>> getPostHandlers() -
isStoreResult
public boolean isStoreResult() -
getNext
public Function<SingleItemSelector.SingleItemSelectorContext<String,SelectorItem<String>>, getNext()String>
-