public class BinaryExceptionClassifier extends SubclassClassifier<java.lang.Throwable,java.lang.Boolean>
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).SubclassClassifier| Modifier and Type | Field and Description |
|---|---|
private boolean |
traverseCauses |
| Constructor and Description |
|---|
BinaryExceptionClassifier(boolean defaultValue)
Create a binary exception classifier with the provided default value.
|
BinaryExceptionClassifier(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses)
Create a binary exception classifier with the default value false and
value mapping true for the provided classes and their subclasses.
|
BinaryExceptionClassifier(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses,
boolean value)
Create a binary exception classifier with the provided classes and their
subclasses.
|
BinaryExceptionClassifier(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> typeMap)
Create a binary exception classifier using the given classification map
and a default classification of false.
|
BinaryExceptionClassifier(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> typeMap,
boolean defaultValue)
Create a binary exception classifier using the given classification map
and a default classification of false.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Boolean |
classify(java.lang.Throwable classifiable)
Return the value from the type map whose key is the class of the given
Throwable, or its nearest ancestor if a subclass.
|
void |
setTraverseCauses(boolean traverseCauses) |
getClassified, getDefault, setDefaultValue, setTypeMappublic BinaryExceptionClassifier(boolean defaultValue)
defaultValue - defaults to falsepublic BinaryExceptionClassifier(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses,
boolean value)
value - public BinaryExceptionClassifier(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses)
public BinaryExceptionClassifier(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> typeMap)
typeMap - public BinaryExceptionClassifier(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> typeMap,
boolean defaultValue)
typeMap - public void setTraverseCauses(boolean traverseCauses)
public java.lang.Boolean classify(java.lang.Throwable classifiable)
SubclassClassifierclassify in interface Classifier<java.lang.Throwable,java.lang.Boolean>classify in class SubclassClassifier<java.lang.Throwable,java.lang.Boolean>classifiable - the input object. Can be null.