Coverage Report - org.seasar.cubby.plugins.s2.customizer.ActionMethodCustomizer
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionMethodCustomizer
0%
0/9
0%
0/4
3
 
 1  
 /*
 2  
  * Copyright 2004-2009 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.cubby.plugins.s2.customizer;
 17  
 
 18  
 import org.seasar.framework.aop.Pointcut;
 19  
 import org.seasar.framework.container.customizer.AspectCustomizer;
 20  
 import org.seasar.framework.util.StringUtil;
 21  
 
 22  
 /**
 23  
  * {@link org.seasar.framework.container.ComponentDef コンポーネント定義}に
 24  
  * {@link org.seasar.framework.container.AspectDef アスペクト定義}を
 25  
  * 登録するコンポーネントカスタマイザです。
 26  
  * <p>
 27  
  * カスタマイザには、ポイントカットとインターセプタを設定します。 インターセプタはコンポーネント名で指定し、複数のインターセプタ名を設定することができます。
 28  
  * インターセプタ名が複数設定された場合は、設定された順にアスペクト定義をコンポーネント定義に登録します。
 29  
  * 最初に設定された名前を持つインターセプタが、後に設定された名前を持つインターセプタよりも先に呼び出されることになります。
 30  
  * </p>
 31  
  * <p>
 32  
  * コンポーネントに適用するインターセプタのインスタンス属性が<code>singleton</code>以外の場合は、
 33  
  * {@link #setUseLookupAdapter(boolean) useLookupAdapter}プロパティを<code>true</code>
 34  
  * に設定します。 これにより、コンポーネントのメソッドが呼び出される度に、コンテナからインターセプタのインスタンスをルックアップするようになります。
 35  
  * </p>
 36  
  * 
 37  
  * @author baba
 38  
  */
 39  0
 public class ActionMethodCustomizer extends AspectCustomizer {
 40  
 
 41  
         private String pointcut;
 42  
 
 43  
         /**
 44  
          * コンポーネント定義に登録するアスペクト定義のポイントカットを設定します。
 45  
          * 
 46  
          * @param pointcut
 47  
          *            ポイントカット
 48  
          */
 49  
         @Override
 50  
         public void setPointcut(final String pointcut) {
 51  0
                 super.setPointcut(pointcut);
 52  0
                 this.pointcut = pointcut;
 53  0
         }
 54  
 
 55  
         /**
 56  
          * ポイントカットを作成して返します。
 57  
          * <p>
 58  
          * <code>pointcut</code>プロパティが指定されている場合は、その文字列からポイントカットを作成します。
 59  
          * <code>targetInterface</code>プロパティが指定されている場合は、そのインターフェースからポイントカットを作成します。
 60  
          * それ以外の場合は<code>null</code>を返します。
 61  
          * </p>
 62  
          * 
 63  
          * @return ポイントカット
 64  
          */
 65  
         @Override
 66  
         protected Pointcut createPointcut() {
 67  0
                 if (!StringUtil.isEmpty(pointcut)) {
 68  0
                         return PointcutFactory.createPointcut(pointcut);
 69  
                 }
 70  0
                 if (targetInterface != null) {
 71  0
                         return PointcutFactory.createPointcut(targetInterface);
 72  
                 }
 73  0
                 return null;
 74  
         }
 75  
 
 76  
 }