KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > dispatch > DispatchTask


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.dispatch;
19
20 import org.apache.tools.ant.Task;
21
22 /**
23  * Tasks extending this class may contain multiple actions.
24  * The method that is invoked for execution depends upon the
25  * value of the action attribute of the task.
26  * <br/>
27  * Example:<br/>
28  * &lt;mytask action=&quot;list&quot;/&gt; will invoke the method
29  * with the signature public void list() in mytask's class.
30  * If the action attribute is not defined in the task or is empty,
31  * the execute() method will be called.
32  */

33 public abstract class DispatchTask extends Task implements Dispatchable {
34     private String JavaDoc action;
35
36     /**
37      * Get the action parameter name.
38      * @return the <code>String</code> "action" by default (can be overridden).
39      */

40     public String JavaDoc getActionParameterName() {
41         return "action";
42     }
43
44     /**
45      * Set the action.
46      * @param action the method name.
47      */

48     public void setAction(String JavaDoc action) {
49         this.action = action;
50     }
51
52     /**
53      * Get the action.
54      * @return the action.
55      */

56     public String JavaDoc getAction() {
57         return action;
58     }
59 }
60
Popular Tags