001
014
015 package com.liferay.portal.spring.aop;
016
017
020 public class ChainableMethodAdviceInjector {
021
022 public void afterPropertiesSet() {
023 if (!isInjectCondition()) {
024 return;
025 }
026
027 ChainableMethodAdvice newChainableMethodAdvice =
028 getNewChainableMethodAdvice();
029
030 if (newChainableMethodAdvice == null) {
031 throw new IllegalArgumentException(
032 "New Chainable method advice is null");
033 }
034
035 ChainableMethodAdvice parentChainableMethodAdvice =
036 getParentChainableMethodAdvice();
037
038 if (parentChainableMethodAdvice == null) {
039 throw new IllegalArgumentException(
040 "Parent chainable method advice is null");
041 }
042
043 newChainableMethodAdvice.nextMethodInterceptor =
044 parentChainableMethodAdvice.nextMethodInterceptor;
045 parentChainableMethodAdvice.nextMethodInterceptor =
046 newChainableMethodAdvice;
047 }
048
049 public void setInjectCondition(boolean injectCondition) {
050 _injectCondition = injectCondition;
051 }
052
053 public void setNewChainableMethodAdvice(
054 ChainableMethodAdvice newChainableMethodAdvice) {
055
056 _newChainableMethodAdvice = newChainableMethodAdvice;
057 }
058
059 public void setParentChainableMethodAdvice(
060 ChainableMethodAdvice parentChainableMethodAdvice) {
061
062 _parentChainableMethodAdvice = parentChainableMethodAdvice;
063 }
064
065 protected ChainableMethodAdvice getNewChainableMethodAdvice() {
066 return _newChainableMethodAdvice;
067 }
068
069 protected ChainableMethodAdvice getParentChainableMethodAdvice() {
070 return _parentChainableMethodAdvice;
071 }
072
073 protected boolean isInjectCondition() {
074 return _injectCondition;
075 }
076
077 private boolean _injectCondition;
078 private ChainableMethodAdvice _newChainableMethodAdvice;
079 private ChainableMethodAdvice _parentChainableMethodAdvice;
080
081 }