Class StringInput
java.lang.Object
org.springframework.shell.component.support.AbstractComponent<C>
org.springframework.shell.component.support.AbstractTextComponent<String,StringInput.StringInputContext>
org.springframework.shell.component.StringInput
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ResourceLoaderAware
Component for a simple string input.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.shell.component.support.AbstractTextComponent
AbstractTextComponent.BaseTextComponentContext<T,
C extends AbstractTextComponent.TextComponentContext<T, C>>, AbstractTextComponent.TextComponentContext<T, C extends AbstractTextComponent.TextComponentContext<T, C>> -
Field Summary
Fields inherited from class org.springframework.shell.component.support.AbstractComponent
OPERATION_BACKSPACE, OPERATION_CHAR, OPERATION_DOWN, OPERATION_EXIT, OPERATION_SELECT, OPERATION_UNICODE, OPERATION_UP
-
Constructor Summary
ConstructorDescriptionStringInput
(org.jline.terminal.Terminal terminal) StringInput
(org.jline.terminal.Terminal terminal, String name, String defaultValue) StringInput
(org.jline.terminal.Terminal terminal, String name, String defaultValue, Function<StringInput.StringInputContext, List<org.jline.utils.AttributedString>> renderer) -
Method Summary
Modifier and TypeMethodDescriptiongetThisContext
(ComponentContext<?> context) Gets a real component context using common this trick.protected boolean
read
(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<String> keyMap, StringInput.StringInputContext context) Read input.void
setMaskCharacter
(Character maskCharacter) Sets a mask character for input and result value.Methods inherited from class org.springframework.shell.component.support.AbstractTextComponent
bindKeyMap, getName, runInternal
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
-
StringInput
public StringInput(org.jline.terminal.Terminal terminal) -
StringInput
-
StringInput
public StringInput(org.jline.terminal.Terminal terminal, String name, String defaultValue, Function<StringInput.StringInputContext, List<org.jline.utils.AttributedString>> renderer)
-
-
Method Details
-
setMaskCharacter
Sets a mask character for input and result value.- Parameters:
maskCharacter
- a mask character
-
getThisContext
Description copied from class:AbstractComponent
Gets a real component context using common this trick.- Specified by:
getThisContext
in classAbstractComponent<StringInput.StringInputContext>
- Parameters:
context
- the context- Returns:
- a component context
-
read
protected boolean read(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<String> keyMap, StringInput.StringInputContext context) Description copied from class:AbstractComponent
Read input.- Specified by:
read
in classAbstractComponent<StringInput.StringInputContext>
- Parameters:
bindingReader
- the binding readerkeyMap
- the key mapcontext
- the context- Returns:
- true if read is complete, false to stop
-