KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > chain > generic > RemoveCommand


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
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.apache.commons.chain.generic;
17
18
19 import org.apache.commons.chain.Command;
20 import org.apache.commons.chain.Context;
21
22
23 /**
24  * <p>Remove any context attribute stored under the <code>fromKey</code>.</p>
25  *
26  * @author Craig R. McClanahan
27  * @version $Revision: 1.6 $ $Date: 2004/02/25 00:01:07 $
28  */

29
30 public class RemoveCommand implements Command {
31
32
33     // -------------------------------------------------------------- Properties
34

35
36     private String JavaDoc fromKey = null;
37
38
39     /**
40      * <p>Return the context attribute key for the attribute.</p>
41      */

42     public String JavaDoc getFromKey() {
43
44     return (this.fromKey);
45
46     }
47
48
49     /**
50      * <p>Set the context attribute key for the attribute.</p>
51      *
52      * @param fromKey The new key
53      */

54     public void setFromKey(String JavaDoc fromKey) {
55
56     this.fromKey = fromKey;
57
58     }
59
60
61     // ---------------------------------------------------------- Filter Methods
62

63
64     /**
65      * <p>Copy the specified source attribute to the specified destination
66      * attribute.</p>
67      *
68      * @param context {@link Context} in which we are operating
69      *
70      * @return <code>false</code> so that processing will continue
71      */

72     public boolean execute(Context context) throws Exception JavaDoc {
73
74     context.remove(getFromKey());
75     return (false);
76
77     }
78
79
80 }
81
Popular Tags