001/*
002 * Copyright 2002-2019 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.interceptor;
018
019import org.springframework.lang.Nullable;
020import org.springframework.transaction.TransactionDefinition;
021
022/**
023 * This interface adds a {@code rollbackOn} specification to {@link TransactionDefinition}.
024 * As custom {@code rollbackOn} is only possible with AOP, it resides in the AOP-related
025 * transaction subpackage.
026 *
027 * @author Rod Johnson
028 * @author Juergen Hoeller
029 * @since 16.03.2003
030 * @see DefaultTransactionAttribute
031 * @see RuleBasedTransactionAttribute
032 */
033public interface TransactionAttribute extends TransactionDefinition {
034
035        /**
036         * Return a qualifier value associated with this transaction attribute.
037         * <p>This may be used for choosing a corresponding transaction manager
038         * to process this specific transaction.
039         * @since 3.0
040         */
041        @Nullable
042        String getQualifier();
043
044        /**
045         * Should we roll back on the given exception?
046         * @param ex the exception to evaluate
047         * @return whether to perform a rollback or not
048         */
049        boolean rollbackOn(Throwable ex);
050
051}