KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > action > LocalBeanInvokingAction


1 /*
2  * Copyright 2002-2006 the original author or authors.
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, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.action;
17
18 import java.io.Serializable JavaDoc;
19
20 import org.springframework.binding.method.MethodSignature;
21 import org.springframework.util.Assert;
22 import org.springframework.webflow.execution.RequestContext;
23
24 /**
25  * Thin action proxy that delegates to a method on an arbitrary bean. The bean
26  * instance is managed locally by this Action in an instance variable.
27  *
28  * @author Keith Donald
29  */

30 class LocalBeanInvokingAction extends AbstractBeanInvokingAction implements Serializable JavaDoc {
31
32     /**
33      * The target bean (any POJO) to invoke.
34      */

35     private Object JavaDoc bean;
36
37     /**
38      * Creates a bean invoking action that invokes a method on the specified bean.
39      * The bean may be a proxy providing a layer of indirection if necessary.
40      * @param bean the bean to invoke
41      */

42     public LocalBeanInvokingAction(MethodSignature methodSignature, Object JavaDoc bean) {
43         super(methodSignature);
44         Assert.notNull(bean, "The bean to invoke by this action cannot be null");
45         this.bean = bean;
46     }
47
48     /**
49      * Returns the target bean to invoke methods on.
50      */

51     public Object JavaDoc getBean() {
52         return bean;
53     }
54
55     protected Object JavaDoc getBean(RequestContext context) throws Exception JavaDoc {
56         return getBean();
57     }
58 }
Popular Tags