接口 TransactionAnnotationParser
- 所有已知实现类:
Ejb3TransactionAnnotationParser,JtaTransactionAnnotationParser,SpringTransactionAnnotationParser
public interface TransactionAnnotationParser
Strategy interface for parsing known transaction annotation types.AnnotationTransactionAttributeSourcedelegates to such parsers for supporting specific annotation types such as Spring's ownTransactional, JTA 1.2'sTransactionalor EJB3'sTransactionAttribute.- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller
- 另请参阅:
AnnotationTransactionAttributeSource,SpringTransactionAnnotationParser,Ejb3TransactionAnnotationParser,JtaTransactionAnnotationParser
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default booleanisCandidateClass(Class<?> targetClass)Determine whether the given class is a candidate for transaction attributes in the annotation format of thisTransactionAnnotationParser.TransactionAttributeparseTransactionAnnotation(AnnotatedElement element)Parse the transaction attribute for the given method or class, based on an annotation type understood by this parser.
方法详细资料
isCandidateClass
default boolean isCandidateClass(Class<?> targetClass)
Determine whether the given class is a candidate for transaction attributes in the annotation format of thisTransactionAnnotationParser.If this method returns
false, the methods on the given class will not get traversed for#parseTransactionAnnotationintrospection. Returningfalseis therefore an optimization for non-affected classes, whereastruesimply means that the class needs to get fully introspected for each method on the given class individually.- 参数:
targetClass- the class to introspect- 返回:
falseif the class is known to have no transaction annotations at class or method level;trueotherwise. The default implementation returnstrue, leading to regular introspection.- 从以下版本开始:
- 5.2
parseTransactionAnnotation
@Nullable 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
nullif the method/class is not transactional.- 参数:
element- the annotated method or class- 返回:
- the configured transaction attribute, or
nullif none found - 另请参阅:
AnnotationTransactionAttributeSource.determineTransactionAttribute(java.lang.reflect.AnnotatedElement)