Enum TransactionPhase
- java.lang.Object
- java.lang.Enum<TransactionPhase>
- org.springframework.transaction.event.TransactionPhase
- All Implemented Interfaces:
Serializable
,Comparable<TransactionPhase>
public enum TransactionPhase extends Enum<TransactionPhase>
The phase at which a transactional event listener applies.- Since:
- 4.2
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
TransactionalEventListener
Enum Constant Summary
Enum Constants Enum Constant Description AFTER_COMMIT
Fire the event after the commit has completed successfully.AFTER_COMPLETION
Fire the event after the transaction has completed.AFTER_ROLLBACK
Fire the event if the transaction has rolled back.BEFORE_COMMIT
Fire the event before transaction commit.
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TransactionPhase
valueOf(String name)
Returns the enum constant of this type with the specified name.static TransactionPhase[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
Enum Constant Detail
BEFORE_COMMIT
public static final TransactionPhase BEFORE_COMMIT
Fire the event before transaction commit.
AFTER_COMMIT
public static final TransactionPhase AFTER_COMMIT
Fire the event after the commit has completed successfully.Note: This is a specialization of
AFTER_COMPLETION
and therefore executes in the same after-completion sequence of events, (and not inTransactionSynchronization.afterCommit()
).
AFTER_ROLLBACK
public static final TransactionPhase AFTER_ROLLBACK
Fire the event if the transaction has rolled back.Note: This is a specialization of
AFTER_COMPLETION
and therefore executes in the same after-completion sequence of events.
AFTER_COMPLETION
public static final TransactionPhase AFTER_COMPLETION
Fire the event after the transaction has completed.For more fine-grained events, use
AFTER_COMMIT
orAFTER_ROLLBACK
to intercept transaction commit or rollback, respectively.
Method Detail
values
public static TransactionPhase[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TransactionPhase c : TransactionPhase.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static TransactionPhase valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null