Class RollbackRuleAttribute
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NoRollbackRuleAttribute
Multiple such rules can be applied to determine whether a transaction should commit or rollback after an exception has been thrown.
- Since:
- 09.04.2003
- Author:
- Rod Johnson
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RollbackRuleAttributeTherollback ruleforRuntimeExceptions. -
Constructor Summary
ConstructorsConstructorDescriptionRollbackRuleAttribute(Class<?> clazz) Create a new instance of theRollbackRuleAttributeclass.RollbackRuleAttribute(String exceptionName) Create a new instance of theRollbackRuleAttributeclass for the givenexceptionName. -
Method Summary
-
Field Details
-
ROLLBACK_ON_RUNTIME_EXCEPTIONS
Therollback ruleforRuntimeExceptions.
-
-
Constructor Details
-
RollbackRuleAttribute
Create a new instance of theRollbackRuleAttributeclass.This is the preferred way to construct a rollback rule that matches the supplied
Exceptionclass, its subclasses, and its nested classes.- Parameters:
clazz- throwable class; must beThrowableor a subclass ofThrowable- Throws:
IllegalArgumentException- if the suppliedclazzis not aThrowabletype or isnull
-
RollbackRuleAttribute
Create a new instance of theRollbackRuleAttributeclass for the givenexceptionName.This can be a substring, with no wildcard support at present. A value of "ServletException" would match
jakarta.servlet.ServletExceptionand subclasses, for example.NB: Consider carefully how specific the pattern is, and whether to include package information (which is not mandatory). For example, "Exception" will match nearly anything, and will probably hide other rules. "java.lang.Exception" would be correct if "Exception" was meant to define a rule for all checked exceptions. With more unusual exception names such as "BaseBusinessException" there's no need to use a fully package-qualified name.
- Parameters:
exceptionName- the exception name pattern; can also be a fully package-qualified class name- Throws:
IllegalArgumentException- if the suppliedexceptionNameisnullor empty
-
-
Method Details
-
getExceptionName
Return the pattern for the exception name. -
getDepth
Return the depth of the superclass matching.0meansexmatches exactly. Returns-1if there is no match. Otherwise, returns depth with the lowest depth winning. -
equals
-
hashCode
public int hashCode() -
toString
-