Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EventListenerDef |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2004-2008 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.uruma.binding.method; | |
17 | ||
18 | import java.lang.reflect.Method; | |
19 | ||
20 | import org.seasar.uruma.annotation.AsyncMethod; | |
21 | import org.seasar.uruma.annotation.EventListener; | |
22 | import org.seasar.uruma.annotation.EventListenerType; | |
23 | import org.seasar.uruma.util.AssertionUtil; | |
24 | ||
25 | /** | |
26 | * {@link EventListener} アノテートされたメソッドを表すクラスです。<br /> | |
27 | * | |
28 | * @author y-komori | |
29 | */ | |
30 | public class EventListenerDef { | |
31 | private Method targetMethod; | |
32 | ||
33 | private EventListener eventListener; | |
34 | ||
35 | private AsyncMethod asyncMethod; | |
36 | ||
37 | /** | |
38 | * {@link EventListenerDef} を構築します。<br /> | |
39 | * | |
40 | * @param target | |
41 | * ターゲットメソッド | |
42 | * @param eventListener | |
43 | * {@link EventListener} | |
44 | * @param asyncMethod | |
45 | * {@link AsyncMethod} アノテーション | |
46 | */ | |
47 | public EventListenerDef(final Method target, | |
48 | 428 | final EventListener eventListener, final AsyncMethod asyncMethod) { |
49 | 428 | AssertionUtil.assertNotNull("target", target); |
50 | 428 | AssertionUtil.assertNotNull("eventListener", eventListener); |
51 | 428 | this.targetMethod = target; |
52 | 428 | this.eventListener = eventListener; |
53 | 428 | this.asyncMethod = asyncMethod; |
54 | 428 | } |
55 | ||
56 | /** | |
57 | * ターゲットメソッドの {@link Method} オブジェクトを取得します。<br /> | |
58 | * | |
59 | * @return ターゲットメソッドの {@link Method} オブジェクト | |
60 | */ | |
61 | public Method getTargetMethod() { | |
62 | 856 | return this.targetMethod; |
63 | } | |
64 | ||
65 | /** | |
66 | * 対応するコンポーネントの ID を取得します。<br /> | |
67 | * | |
68 | * @return 対応するコンポーネントの ID | |
69 | */ | |
70 | public String[] getId() { | |
71 | 428 | return this.eventListener.id(); |
72 | } | |
73 | ||
74 | /** | |
75 | * イベントの種類を返します。<br /> | |
76 | * | |
77 | * @return イベントの種類 | |
78 | */ | |
79 | public EventListenerType getType() { | |
80 | 844 | return this.eventListener.type(); |
81 | } | |
82 | ||
83 | /** | |
84 | * {@link AsyncMethod} アノテーションを返します。<br /> | |
85 | * | |
86 | * @return {@link AsyncMethod} アノテーション。アノテーションが存在しない場合は <code>null</code>。 | |
87 | */ | |
88 | public AsyncMethod getAsyncMethod() { | |
89 | 428 | return this.asyncMethod; |
90 | } | |
91 | } |