レコードクラス CommandContext

java.lang.ObjectSE
java.lang.RecordSE
org.springframework.shell.core.command.CommandContext

public record CommandContext(ParsedInput parsedInput, CommandRegistry commandRegistry, PrintWriterSE outputWriter, InputReader inputReader) extends RecordSE
現在のコマンド呼び出しに関する実行時情報を格納するインターフェース。
導入:
4.0.0
作成者:
Mahmoud Ben Hassine
  • コンストラクターの詳細

    • CommandContext

      public CommandContext(ParsedInput parsedInput, CommandRegistry commandRegistry, PrintWriterSE outputWriter, InputReader inputReader)
      CommandContext レコードクラスのインスタンスを作成します。
      パラメーター:
      parsedInput - parsedInput レコードコンポーネントの値
      commandRegistry - commandRegistry レコードコンポーネントの値
      outputWriter - outputWriter レコードコンポーネントの値
      inputReader - inputReader レコードコンポーネントの値
  • メソッドの詳細

    • getOptionByName

      public @Nullable CommandOption getOptionByName(StringSE optionName)
      コマンドオプションをその名前 (長い名前または短い名前) で取得します。
      パラメーター:
      optionName - 取得するオプションの名前
      戻り値:
      一致する CommandOption、見つからない場合は null
    • getArgumentByIndex

      public @Nullable CommandArgument getArgumentByIndex(int index)
      インデックスによってコマンド引数を取得します。
      パラメーター:
      index - 取得する引数のインデックス
      戻り値:
      the matching CommandArgument
    • toString

      public final StringSE toString()
      このレコードクラスの文字列表現を返します。表現には、クラスの名前が含まれ、その後に各レコードコンポーネントの名前と値が続きます。
      次で指定:
      クラス RecordSEtoString 
      戻り値:
      このオブジェクトの文字列表現
    • hashCode

      public final int hashCode()
      このオブジェクトのハッシュコード値を返します。値は、各レコードコンポーネントのハッシュコードから導出されます。
      次で指定:
      クラス RecordSEhashCode 
      戻り値:
      このオブジェクトのハッシュコード値
    • equals

      public final boolean equals(ObjectSE o)
      他のオブジェクトがこのオブジェクトと「等しい」かどうかを示します。他のオブジェクトが同じクラスであり、すべてのレコードコンポーネントが等しい場合、オブジェクトは等しいです。このレコードクラスのすべてのコンポーネントが Objects::equals(Object,Object)SE と比較されます。
      次で指定:
      クラス RecordSEequalsSE 
      パラメーター:
      o - 比較するオブジェクト
      戻り値:
      このオブジェクトが o 引数と同じ場合は true。それ以外の場合は false
    • parsedInput

      public ParsedInput parsedInput()
      parsedInput レコードコンポーネントの値を返します。
      戻り値:
      parsedInput レコードコンポーネントの値
    • commandRegistry

      public CommandRegistry commandRegistry()
      commandRegistry レコードコンポーネントの値を返します。
      戻り値:
      commandRegistry レコードコンポーネントの値
    • outputWriter

      public PrintWriterSE outputWriter()
      outputWriter レコードコンポーネントの値を返します。
      戻り値:
      outputWriter レコードコンポーネントの値
    • inputReader

      public InputReader inputReader()
      inputReader レコードコンポーネントの値を返します。
      戻り値:
      inputReader レコードコンポーネントの値