クラス AbstractComponent<T extends ComponentContext<T>>
java.lang.ObjectSE
org.springframework.shell.component.support.AbstractComponent<T>
- 実装されているすべてのインターフェース:
org.springframework.beans.factory.Aware,org.springframework.context.ResourceLoaderAware
- 既知の直属サブクラス
AbstractSelectorComponent,AbstractTextComponent
public abstract class AbstractComponent<T extends ComponentContext<T>>
extends ObjectSE
implements org.springframework.context.ResourceLoaderAware
コンポーネントの基本クラス。
フィールドのサマリー
フィールドコンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明voidaddPostRunHandler(ConsumerSE<T> handler) 実行後のハンドラーを追加します。voidaddPreRunHandler(ConsumerSE<T> handler) 実行前ハンドラーを追加します。protected abstract voidbindKeyMap(org.jline.keymap.KeyMap<StringSE> keyMap) キーマップをバインドします。テンプレートエグゼキュータを取得します。org.jline.terminal.TerminalTerminalを取得します。abstract TgetThisContext(ComponentContext<?> context) 共通のこのトリックを使用して、実際のコンポーネントコンテキストを取得します。protected booleanhasTty()このコンポーネントに既存のttyがあるかどうかを確認します。protected voidloop(ComponentContext<?> context) 読み取りループに入ります。protected abstract booleanread(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<StringSE> keyMap, T context) 入力を読み取ります。ListSE<org.jline.utils.AttributedString>指定されたコンテキストを使用して、設定されたディスプレイレンダラーでディスプレイのコンテンツを表示するようにレンダリングします。protected ListSE<org.jline.utils.AttributedString>renderTemplateResource(MapSE<StringSE, ObjectSE> attributes) 特定のテンプレートを属性付きでレンダリングします。final Trun(ComponentContext<?> context) 指定されたコンテキストでコンポーネントロジックを実行し、更新されたコンテキストを返します。protected abstract TrunInternal(T context) public run メソッドから呼び出される内部ロジックを実行します。protected TrunPostRunHandlers(T context) 実行後のハンドラーを実行するprotected TrunPreRunHandlers(T context) 実行前ハンドラーを実行するvoidsetPrintResults(boolean printResults) 結果をコンソールに出力するかどうかを設定します。デフォルトはtrueです。voidsetRenderer(FunctionSE<T, ListSE<org.jline.utils.AttributedString>> renderer) 表示レンダラーを設定します。voidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) voidsetTemplateExecutor(TemplateExecutor templateExecutor) テンプレート実行者を設定します。voidsetTemplateLocation(StringSE templateLocation) テンプレートの場所を設定します。
フィールドの詳細
コンストラクターの詳細
AbstractComponent
public AbstractComponent(org.jline.terminal.Terminal terminal)
メソッドの詳細
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - 次で指定:
- インターフェース
org.springframework.context.ResourceLoaderAwareのsetResourceLoader
getTerminal
public org.jline.terminal.Terminal getTerminal()Terminalを取得します。- 戻り値:
- ターミナル
setRenderer
表示レンダラーを設定します。- パラメーター:
renderer- 表示レンダラー関数
render
指定されたコンテキストを使用して、設定されたディスプレイレンダラーでディスプレイのコンテンツを表示するようにレンダリングします。- パラメーター:
context- コンテキスト- 戻り値:
- 属性付き文字列のリスト
addPreRunHandler
実行前ハンドラーを追加します。- パラメーター:
handler- ハンドラー
addPostRunHandler
実行後のハンドラーを追加します。- パラメーター:
handler- ハンドラー
setPrintResults
public void setPrintResults(boolean printResults) 結果をコンソールに出力するかどうかを設定します。デフォルトはtrueです。- パラメーター:
printResults- 結果を出力する場合のフラグ設定
run
指定されたコンテキストでコンポーネントロジックを実行し、更新されたコンテキストを返します。- パラメーター:
context- コンテキスト- 戻り値:
- コンテキスト
getTemplateExecutor
テンプレートエグゼキュータを取得します。- 戻り値:
- テンプレートエグゼキュータ
setTemplateExecutor
テンプレート実行者を設定します。- パラメーター:
templateExecutor- テンプレート実行者
setTemplateLocation
テンプレートの場所を設定します。- パラメーター:
templateLocation- テンプレートの場所
hasTty
protected boolean hasTty()このコンポーネントに既存のttyがあるかどうかを確認します。- 戻り値:
- コンポーネントに tty がある場合は true
renderTemplateResource
protected ListSE<org.jline.utils.AttributedString> renderTemplateResource(MapSE<StringSE, ObjectSE> attributes) 特定のテンプレートを属性付きでレンダリングします。- パラメーター:
attributes- 属性- 戻り値:
- コンテンツを属性付き文字列としてレンダリング
getThisContext
共通のこのトリックを使用して、実際のコンポーネントコンテキストを取得します。- パラメーター:
context- コンテキスト- 戻り値:
- コンポーネントコンテキスト
read
protected abstract boolean read(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<StringSE> keyMap, T context) 入力を読み取ります。- パラメーター:
bindingReader- バインディングリーダーkeyMap- キーマップcontext- コンテキスト- 戻り値:
- 読み取りが完了した場合は true、停止する場合は false
runInternal
public run メソッドから呼び出される内部ロジックを実行します。- パラメーター:
context- コンテキスト- 戻り値:
- コンテキスト
bindKeyMap
キーマップをバインドします。- パラメーター:
keyMap-
loop
読み取りループに入ります。これは、コンポーネントから呼び出す必要があります。- パラメーター:
context- コンテキスト
runPreRunHandlers
実行前ハンドラーを実行する- パラメーター:
context- コンテキスト- 戻り値:
- コンテキスト
runPostRunHandlers
実行後のハンドラーを実行する- パラメーター:
context- コンテキスト- 戻り値:
- コンテキスト