Interface IRule

All Known Implementing Classes:
CamelToSnakeCaseRule, ChainRule, DatabaseFetchRule, LowerCaseRule, MdcSetupRule, PassThroughRule, PooledDatabaseFetchRule, SnakeToCamelCaseRule, TrimRule
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IRule
ルールインターフェース

このインターフェースは、ストリーム変換のルールを定義するためのものです。 具体的なルールはこのインターフェースを実装するクラスで定義されます。 ルールは、ストリーム変換の際に適用される条件や処理を定義します。

このインターフェースは関数型インターフェースです。ラムダ式やメソッド参照で実装できます。

使用例:


 // 単純な変換ルール
 IRule upperCaseRule = input -> input.toUpperCase();
 IRule trimRule = String::trim;

 // 複合ルール(トリムして大文字に変換)
 IRule trimAndUpperCase = input -> input.trim().toUpperCase();

 // StreamConverterコマンドでの使用例
 IRule dataCleaningRule = input -> input.trim().replaceAll("\\s+", " ");
 JsonNavigateCommand command = JsonNavigateCommand.create(
     TreePath.fromJson("$.user.name"),
     dataCleaningRule
 );
 
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(String input)
    ルールの適用を実行します。
  • Method Details

    • apply

      ルールの適用を実行します。

      このメソッドは、ストリーム変換の際にルールを適用するために使用されます。 具体的なルールの実装は、このメソッドをオーバーライドして定義します。 変換対象とする箇所を特定したあとにこのメソッドを呼び出すことを想定しています。

      Parameters:
      input - 変換対象の文字列
      Returns:
      String output 変換結果を格納する文字列