クラス ExceptionMatcher

java.lang.ObjectSE
org.springframework.kafka.support.ExceptionMatcher

public class ExceptionMatcher extends ObjectSE
ネストされた原因内で一致する例外を識別するための、設定可能な例外マッチャー。マッチャーは 2 つの方法で設定できます。
  1. With an allow list, only the registered exception matches. This includes exceptions that extend from any registered exception or implement it if that's an interface.
  2. () deny list の場合、例外は登録済みの例外に含まれない場合にのみ一致します。ホワイトリストの場合、登録済みの例外のいずれかを継承または実装する例外は一致しません。
デフォルトでは、指定された ThrowableSE のみがインスペクションされます。ネストされた原因も検索するには、traverseCauses を有効にする必要があります。
導入:
4.0
作成者:
Stephane Nicoll, Dave Syer, Gary Russell
  • コンストラクターの詳細

    • ExceptionMatcher

      public ExceptionMatcher(CollectionSE<ClassSE<? extends ThrowableSE>> exceptionTypes, boolean shouldMatchIfFound)
      例外リストを持つインスタンスを作成します。shouldMatchIfFound パラメーターは、リスト内に例外が見つかった場合に何が起こるかを決定します。
      パラメーター:
      exceptionTypes - 登録の例外
      shouldMatchIfFound - match result if a candidate exception is found amongst the given list
    • ExceptionMatcher

      protected ExceptionMatcher(MapSE<ClassSE<? extends ThrowableSE>, BooleanSE> entries, boolean matchIfNotFound, boolean traverseCauses)
  • メソッドの詳細

    • defaultMatcher

      public static ExceptionMatcher defaultMatcher()
      任意の ExceptionSE に一致するがエラーには一致しないマッチャーを作成します。
      戻り値:
      a matcher that matches any exception, but not errors
    • forAllowList

      public static ExceptionMatcher.Builder forAllowList()
      例外型の構成可能なリストにある例外のみに一致するマッチャーのビルダーを作成します。
      戻り値:
      a ExceptionMatcher.Builder that configures an allowlist of exceptions
    • forDenyList

      public static ExceptionMatcher.Builder forDenyList()
      例外型の構成可能なリストに見つからない例外のみに一致するマッチャーのビルダーを作成します。
      戻り値:
      a ExceptionMatcher.Builder that configures a denylist of exceptions
    • setTraverseCauses

      public void setTraverseCauses(boolean traverseCauses)
      この一致でネストされた原因を走査して一致する例外の存在を確認するかどうかを指定します。
      パラメーター:
      traverseCauses - whether to traverse causes
    • match

      public boolean match(@Nullable ThrowableSE exception)
      指定された ThrowableSE がこのインスタンスと一致するかどうかを指定します。
      パラメーター:
      exception - チェックする例外
      戻り値:
      true if this exception match this instance, false otherwise
    • getEntries

      protected MapSE<ClassSE<? extends ThrowableSE>, BooleanSE> getEntries()