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
Constructors -
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.booleanmax(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 class org.springframework.shell.component.flow.BaseInput
getBuilder, getId, getOrder, order, setOrderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.shell.component.flow.BaseInputSpec
order
-
Constructor Details
-
BaseSingleItemSelector
-
-
Method Details
-
name
Description copied from interface:SingleItemSelectorSpecSets a name.- Specified by:
namein interfaceSingleItemSelectorSpec- Parameters:
name- the name- Returns:
- a builder
-
resultValue
Description copied from interface:SingleItemSelectorSpecSets a result value.- Specified by:
resultValuein interfaceSingleItemSelectorSpec- Parameters:
resultValue- the result value- Returns:
- a builder
-
resultMode
Description copied from interface:SingleItemSelectorSpecSets a result mode.- Specified by:
resultModein interfaceSingleItemSelectorSpec- Parameters:
resultMode- the result mode- Returns:
- a builder
-
selectItem
Description copied from interface:SingleItemSelectorSpecAdds a select item.- Specified by:
selectItemin interfaceSingleItemSelectorSpec- Parameters:
name- the nameitem- the item- Returns:
- a builder
-
selectItems
Description copied from interface:SingleItemSelectorSpecAdds a map of select items.- Specified by:
selectItemsin interfaceSingleItemSelectorSpec- Parameters:
selectItems- the select items- Returns:
- a builder
-
defaultSelect
Description copied from interface:SingleItemSelectorSpecAutomatically selects and exposes a given item.- Specified by:
defaultSelectin interfaceSingleItemSelectorSpec- Parameters:
name- the name- Returns:
- a builder
-
sort
Description copied from interface:SingleItemSelectorSpecSets aComparatorfor sorting items.- Specified by:
sortin 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:SingleItemSelectorSpecSets a renderer function.- Specified by:
rendererin interfaceSingleItemSelectorSpec- Parameters:
renderer- the renderer- Returns:
- a builder
-
template
Description copied from interface:SingleItemSelectorSpecSets a default renderer template location.- Specified by:
templatein interfaceSingleItemSelectorSpec- Parameters:
location- the template location- Returns:
- a builder
-
max
Description copied from interface:SingleItemSelectorSpecSets a maximum number of items in a selector list;- Specified by:
maxin 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:SingleItemSelectorSpecAdds a pre-run context handler.- Specified by:
preHandlerin interfaceSingleItemSelectorSpec- Parameters:
handler- the context handler- Returns:
- a builder
-
postHandler
public SingleItemSelectorSpec postHandler(Consumer<SingleItemSelector.SingleItemSelectorContext<String, SelectorItem<String>>> handler) Description copied from interface:SingleItemSelectorSpecAdds a post-run context handler.- Specified by:
postHandlerin interfaceSingleItemSelectorSpec- Parameters:
handler- the context handler- Returns:
- a builder
-
storeResult
Description copied from interface:SingleItemSelectorSpecAutomatically stores result from aSingleItemSelector.SingleItemSelectorContextintoComponentContextwith key given to builder. Defaults totrue.- Specified by:
storeResultin 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:SingleItemSelectorSpecDefine a function which may return id of a next component to go. Returning anullor non existent id indicates that flow should stop.- Specified by:
nextin interfaceSingleItemSelectorSpec- Parameters:
next- next component function- Returns:
- a builder
-
and
Description copied from interface:SingleItemSelectorSpecBuild and return parent builder.- Specified by:
andin interfaceSingleItemSelectorSpec- Returns:
- the parent builder
-
getThis
Description copied from interface:BaseInputSpecUsual this trick to get typed child.- Specified by:
getThisin 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>
-