Top Description Methods
org.springframework.transaction.annotation

public Interface TransactionAnnotationParser

Known Direct Implementers
org.springframework.transaction.annotation.Ejb3TransactionAnnotationParser, org.springframework.transaction.annotation.JtaTransactionAnnotationParser, org.springframework.transaction.annotation.SpringTransactionAnnotationParser
Imports
java.lang.reflect.AnnotatedElement, org.springframework.lang.Nullable, org.springframework.transaction.interceptor.TransactionAttribute

Strategy interface for parsing known transaction annotation types. AnnotationTransactionAttributeSource delegates to such parsers for supporting specific annotation types such as Spring's own Transactional, JTA 1.2's jakarta.transaction.Transactional or EJB3's jakarta.ejb.TransactionAttribute.
Author
Juergen Hoeller
Since
2.5
See Also
AnnotationTransactionAttributeSource, SpringTransactionAnnotationParser, Ejb3TransactionAnnotationParser, JtaTransactionAnnotationParser

Method Summary

Modifier and TypeMethod and Description
public default boolean

Returns:

false if the class is known to have no transaction annotations at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.
isCandidateClass
(Class<?>
the class to introspect
targetClass
)

Determine whether the given class is a candidate for transaction attributes in the annotation format of this TransactionAnnotationParser.

public TransactionAttribute

Returns:

the configured transaction attribute, or null if none found
parseTransactionAnnotation
(AnnotatedElement
the annotated method or class
element
)

Parse the transaction attribute for the given method or class, based on an annotation type understood by this parser.

Method Detail

isCandidateClassback to summary
public default boolean isCandidateClass(Class<?> targetClass)

Determine whether the given class is a candidate for transaction attributes in the annotation format of this TransactionAnnotationParser.

If this method returns false, the methods on the given class will not get traversed for #parseTransactionAnnotation introspection. Returning false is therefore an optimization for non-affected classes, whereas true simply means that the class needs to get fully introspected for each method on the given class individually.

Parameters
targetClass:Class<?>

the class to introspect

Returns:boolean

false if the class is known to have no transaction annotations at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.

Since
5.2
parseTransactionAnnotationback to summary
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element)

Parse the transaction attribute for the given method or class, based on an annotation type understood by this parser.

This essentially parses a known transaction annotation into Spring's metadata attribute class. Returns null if the method/class is not transactional.

Parameters
element:AnnotatedElement

the annotated method or class

Returns:TransactionAttribute

the configured transaction attribute, or null if none found

Annotations
@Nullable
See Also
AnnotationTransactionAttributeSource#determineTransactionAttribute