Class BinaryExceptionClassifier

java.lang.Object
org.springframework.classify.SubclassClassifier<Throwable,Boolean>
org.springframework.classify.BinaryExceptionClassifier
All Implemented Interfaces:
Serializable, Classifier<Throwable,Boolean>

public class BinaryExceptionClassifier extends SubclassClassifier<Throwable,Boolean>
A Classifier for exceptions that has only two classes (true and false). Classifies objects according to their inheritance relation with the supplied types. If the object to be classified is one of the provided types, or is a subclass of one of the types, then the non-default value is returned (usually true).
Author:
Dave Syer, Gary Russell
See Also:
  • Constructor Details

    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(boolean defaultValue)
      Create a binary exception classifier with the provided default value.
      Parameters:
      defaultValue - defaults to false
    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(Collection<Class<? extends Throwable>> exceptionClasses, boolean value)
      Create a binary exception classifier with the provided classes and their subclasses. The mapped value for these exceptions will be the one provided (which will be the opposite of the default).
      Parameters:
      exceptionClasses - the exceptions to classify among
      value - the value to classify
    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(Collection<Class<? extends Throwable>> exceptionClasses)
      Create a binary exception classifier with the default value false and value mapping true for the provided classes and their subclasses.
      Parameters:
      exceptionClasses - the exception types to throw
    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(Map<Class<? extends Throwable>,Boolean> typeMap)
      Create a binary exception classifier using the given classification map and a default classification of false.
      Parameters:
      typeMap - the map of types
    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(Map<Class<? extends Throwable>,Boolean> typeMap, boolean defaultValue)
      Create a binary exception classifier using the given classification map and the given value for default class.
      Parameters:
      defaultValue - the default value to use
      typeMap - the map of types to classify
    • BinaryExceptionClassifier

      public BinaryExceptionClassifier(Map<Class<? extends Throwable>,Boolean> typeMap, boolean defaultValue, boolean traverseCauses)
      Create a binary exception classifier.
      Parameters:
      defaultValue - the default value to use
      typeMap - the map of types to classify
      traverseCauses - if true, throwable's causes will be inspected to find non-default class
  • Method Details