001/* 002 * Copyright 2002-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.transaction.annotation; 018 019import java.lang.reflect.AnnotatedElement; 020 021import org.springframework.transaction.interceptor.TransactionAttribute; 022 023/** 024 * Strategy interface for parsing known transaction annotation types. 025 * {@link AnnotationTransactionAttributeSource} delegates to such 026 * parsers for supporting specific annotation types such as Spring's own 027 * {@link Transactional}, JTA 1.2's {@link javax.transaction.Transactional} 028 * or EJB3's {@link javax.ejb.TransactionAttribute}. 029 * 030 * @author Juergen Hoeller 031 * @since 2.5 032 * @see AnnotationTransactionAttributeSource 033 * @see SpringTransactionAnnotationParser 034 * @see Ejb3TransactionAnnotationParser 035 * @see JtaTransactionAnnotationParser 036 */ 037public interface TransactionAnnotationParser { 038 039 /** 040 * Parse the transaction attribute for the given method or class, 041 * based on an annotation type understood by this parser. 042 * <p>This essentially parses a known transaction annotation into Spring's metadata 043 * attribute class. Returns {@code null} if the method/class is not transactional. 044 * @param element the annotated method or class 045 * @return the configured transaction attribute, or {@code null} if none found 046 * @see AnnotationTransactionAttributeSource#determineTransactionAttribute 047 */ 048 TransactionAttribute parseTransactionAnnotation(AnnotatedElement element); 049 050}