001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.spring.aop;
016    
017    /**
018     * @author Shuyang Zhou
019     */
020    public class ChainableMethodAdviceInjector {
021    
022            public void afterPropertiesSet() {
023                    if (_injectCondition) {
024                            if (_newChainableMethodAdvice == null) {
025                                    throw new IllegalArgumentException(
026                                            "New ChainableMethodAdvice is null");
027                            }
028    
029                            if (_parentChainableMethodAdvice == null) {
030                                    throw new IllegalArgumentException(
031                                            "Parent ChainableMethodAdvice is null");
032                            }
033    
034                            _newChainableMethodAdvice.nextMethodInterceptor =
035                                    _parentChainableMethodAdvice.nextMethodInterceptor;
036                            _parentChainableMethodAdvice.nextMethodInterceptor =
037                                    _newChainableMethodAdvice;
038                    }
039            }
040    
041            public void setInjectCondition(boolean injectCondition) {
042                    _injectCondition = injectCondition;
043            }
044    
045            public void setNewChainableMethodAdvice(
046                    ChainableMethodAdvice newChainableMethodAdvice) {
047                    _newChainableMethodAdvice = newChainableMethodAdvice;
048            }
049    
050            public void setParentChainableMethodAdvice(
051                    ChainableMethodAdvice parentChainableMethodAdvice) {
052                    _parentChainableMethodAdvice = parentChainableMethodAdvice;
053            }
054    
055            private boolean _injectCondition;
056    
057            private ChainableMethodAdvice _newChainableMethodAdvice;
058    
059            private ChainableMethodAdvice _parentChainableMethodAdvice;
060    
061    }