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.cubby.plugins.s2.aop.ActionMethodPointcutImpl;
19 import org.seasar.framework.aop.Pointcut;
20 import org.seasar.framework.util.StringUtil;
21
22 /**
23 * {@link org.seasar.framework.aop.Pointcut ポイントカット}を構築するためのファクトリクラスです。
24 *
25 * @author baba
26 * @since 2.0.0
27 */
28 class PointcutFactory {
29
30 /**
31 * 指定されたポイントカットを表す文字列から、 {@link org.seasar.framework.aop.Pointcut ポイントカット}
32 * を構築して返します。
33 *
34 * @param pointcutStr
35 * ポイントカットを表す文字列
36 * @return ポイントカット
37 */
38 public static Pointcut createPointcut(final String pointcutStr) {
39 if (!StringUtil.isEmpty(pointcutStr)) {
40 final String[] methodNames = StringUtil.split(pointcutStr, ", \n");
41 return new ActionMethodPointcutImpl(methodNames);
42 }
43 return null;
44 }
45
46 /**
47 * 指定された{@link Class クラス}から、 {@link org.seasar.framework.aop.Pointcut
48 * ポイントカット}を構築して返します。
49 *
50 * @param clazz
51 * クラス
52 * @return ポイントカット
53 */
54 public static Pointcut createPointcut(final Class<?> clazz) {
55 return new ActionMethodPointcutImpl(clazz);
56 }
57
58 }