KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > registry > base > BaseToolDescriptor


1 /*
2  * Copyright 2000-2001,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
17 package org.apache.jetspeed.om.registry.base;
18
19 import org.apache.jetspeed.om.registry.ToolDescriptor;
20
21 /**
22  * Bean-like implementation of the ToolDescriptor interface
23  *
24  * @author <a HREF="mailto:raphael@apache.org">RaphaŽl Luta</a>
25  * @version $Id: BaseToolDescriptor.java,v 1.2 2004/02/23 03:08:26 jford Exp $
26  */

27 public class BaseToolDescriptor implements ToolDescriptor, java.io.Serializable JavaDoc
28 {
29     private String JavaDoc name = null;
30     private String JavaDoc scope = null;
31     private String JavaDoc classname = null;
32
33     /**
34     * Implements the equals operation so that 2 elements are equal if
35     * all their member values are equal.
36     */

37     public boolean equals(Object JavaDoc object)
38     {
39         if (object==null)
40         {
41             return false;
42         }
43
44         BaseToolDescriptor obj = (BaseToolDescriptor)object;
45
46         if (name!=null)
47         {
48             if (!name.equals(obj.getName()))
49             {
50                 return false;
51             }
52         }
53         else
54         {
55             if (obj.getName()!=null)
56             {
57                 return false;
58             }
59         }
60
61         if (scope!=null)
62         {
63             if(!scope.equals(obj.getScope()))
64             {
65                 return false;
66             }
67         }
68         else
69         {
70             if (obj.getScope()!=null)
71             {
72                 return false;
73             }
74         }
75
76         if (classname!=null)
77         {
78             if(!classname.equals(obj.getClassname()))
79             {
80                 return false;
81             }
82         }
83         else
84         {
85             if (obj.getClassname()!=null)
86             {
87                 return false;
88             }
89         }
90
91         return true;
92     }
93
94     /** @return the name of the tool */
95     public String JavaDoc getName()
96     {
97         return this.name;
98     }
99
100     /** Sets the name for this tool
101      * @param title the new name of the tool
102      */

103     public void setName( String JavaDoc name )
104     {
105         this.name = name;
106     }
107
108     /** @return the scope of this tool */
109     public String JavaDoc getScope()
110     {
111         return this.scope;
112     }
113
114     /** Sets the scope of this tool.
115      * The currently recognized scope are "request", "session", "persistent", "global"
116      * @param scope the new scope of this tool
117      */

118     public void setScope( String JavaDoc scope )
119     {
120         this.scope = scope;
121     }
122
123     /** @return the clasname of this tool */
124     public String JavaDoc getClassname()
125     {
126         return this.classname;
127     }
128
129     /** Sets the classname of this tool
130      * @param classname the new classname of this tool
131      */

132     public void setClassname( String JavaDoc classname )
133     {
134         this.classname = classname;
135     }
136 }
137
Popular Tags