1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.spring.aop;
16  
17  /**
18   * <a href="ChainableMethodAdviceInjector.java.html"><b><i>View Source</i></b>
19   * </a>
20   *
21   * @author Shuyang Zhou
22   */
23  public class ChainableMethodAdviceInjector {
24  
25      public void afterPropertiesSet() {
26          if (_injectCondition) {
27              if (_newChainableMethodAdvice == null) {
28                  throw new IllegalArgumentException(
29                      "New ChainableMethodAdvice is null");
30              }
31  
32              if (_parentChainableMethodAdvice == null) {
33                  throw new IllegalArgumentException(
34                      "Parent ChainableMethodAdvice is null");
35              }
36  
37              _newChainableMethodAdvice.nextMethodInterceptor =
38                  _parentChainableMethodAdvice.nextMethodInterceptor;
39              _parentChainableMethodAdvice.nextMethodInterceptor =
40                  _newChainableMethodAdvice;
41          }
42      }
43  
44      public void setInjectCondition(boolean injectCondition) {
45          _injectCondition = injectCondition;
46      }
47  
48      public void setNewChainableMethodAdvice(
49          ChainableMethodAdvice newChainableMethodAdvice) {
50          _newChainableMethodAdvice = newChainableMethodAdvice;
51      }
52  
53      public void setParentChainableMethodAdvice(
54          ChainableMethodAdvice parentChainableMethodAdvice) {
55          _parentChainableMethodAdvice = parentChainableMethodAdvice;
56      }
57  
58      private boolean _injectCondition;
59  
60      private ChainableMethodAdvice _newChainableMethodAdvice;
61  
62      private ChainableMethodAdvice _parentChainableMethodAdvice;
63  
64  }