Class SingleItemSelector<T,I extends Nameable & Matchable & Enableable & Selectable & Itemable<T>>
java.lang.Object
org.springframework.shell.component.support.AbstractComponent<C>
org.springframework.shell.component.support.AbstractSelectorComponent<T,SingleItemSelector.SingleItemSelectorContext<T,I>,I>
org.springframework.shell.component.SingleItemSelector<T,I>
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ResourceLoaderAware
public class SingleItemSelector<T,I extends Nameable & Matchable & Enableable & Selectable & Itemable<T>>
extends AbstractSelectorComponent<T,SingleItemSelector.SingleItemSelectorContext<T,I>,I>
Component able to pick single item.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.shell.component.support.AbstractSelectorComponent
AbstractSelectorComponent.BaseSelectorComponentContext<T,
I extends Nameable & Matchable & Itemable<T>, C extends AbstractSelectorComponent.SelectorComponentContext<T, I, C>>, AbstractSelectorComponent.ItemState<I extends Matchable>, AbstractSelectorComponent.SelectorComponentContext<T, I extends Nameable & Matchable & Itemable<T>, C extends AbstractSelectorComponent.SelectorComponentContext<T, I, C>> -
Field Summary
Fields inherited from class org.springframework.shell.component.support.AbstractSelectorComponent
name
Fields inherited from class org.springframework.shell.component.support.AbstractComponent
OPERATION_BACKSPACE, OPERATION_CHAR, OPERATION_DOWN, OPERATION_EXIT, OPERATION_SELECT, OPERATION_UP
-
Constructor Summary
ConstructorDescriptionSingleItemSelector
(org.jline.terminal.Terminal terminal, List<I> items, String name, Comparator<I> comparator) -
Method Summary
Modifier and TypeMethodDescriptiongetThisContext
(ComponentContext<?> context) Gets a real component context using common this trick.protected SingleItemSelector.SingleItemSelectorContext<T,
I> Run internal logic called from public run method.Methods inherited from class org.springframework.shell.component.support.AbstractSelectorComponent
bindKeyMap, getItemMapper, getItems, read, setDefaultExpose, setItemMapper, setMaxItems
Methods inherited from class org.springframework.shell.component.support.AbstractComponent
addPostRunHandler, addPreRunHandler, getTemplateExecutor, getTerminal, hasTty, loop, render, renderTemplateResource, run, runPostRunHandlers, runPreRunHandlers, setPrintResults, setRenderer, setResourceLoader, setTemplateExecutor, setTemplateLocation
-
Constructor Details
-
SingleItemSelector
public SingleItemSelector(org.jline.terminal.Terminal terminal, List<I> items, String name, Comparator<I> comparator)
-
-
Method Details
-
getThisContext
public SingleItemSelector.SingleItemSelectorContext<T,I> getThisContext(ComponentContext<?> context) Description copied from class:AbstractComponent
Gets a real component context using common this trick.- Specified by:
getThisContext
in classAbstractComponent<SingleItemSelector.SingleItemSelectorContext<T,
I extends Nameable & Matchable & Enableable & Selectable & Itemable<T>>> - Parameters:
context
- the context- Returns:
- a component context
-
runInternal
protected SingleItemSelector.SingleItemSelectorContext<T,I> runInternal(SingleItemSelector.SingleItemSelectorContext<T, I> context) Description copied from class:AbstractComponent
Run internal logic called from public run method.- Overrides:
runInternal
in classAbstractSelectorComponent<T,
SingleItemSelector.SingleItemSelectorContext<T, I extends Nameable & Matchable & Enableable & Selectable & Itemable<T>>, I extends Nameable & Matchable & Enableable & Selectable & Itemable<T>> - Parameters:
context
- the context- Returns:
- a context
-