View Javadoc

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.*;
20  
21  /***
22   * Bean like implementation of the Parameter interface suitable for
23   * Castor serialization.
24   *
25   * @see org.apache.jetspeed.om.registry.Parameter
26   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
27   * @version $Id: BaseParameter.java,v 1.4 2004/02/23 03:08:26 jford Exp $
28   */
29  public class BaseParameter extends BaseRegistryEntry
30      implements Parameter, java.io.Serializable
31  {
32  
33      private String value = null;
34      private String type = null;
35  
36      /***
37       * Implements the equals operation so that 2 elements are equal if
38       * all their member values are equal.
39       */
40      public boolean equals(Object object)
41      {
42          if (object==null)
43          {
44              return false;
45          }
46  
47          BaseParameter obj = (BaseParameter)object;
48  
49          if (value!=null)
50          {
51              if (!value.equals(obj.getValue()))
52              {
53                  return false;
54              }
55          }
56          else
57          {
58              if (obj.getValue()!=null)
59              {
60                  return false;
61              }
62          }
63  
64          if (type!=null)
65          {
66              if(!type.equals(obj.getType()))
67              {
68                  return false;
69              }
70          }
71          else
72          {
73              if (obj.getType()!=null)
74              {
75                  return false;
76              }
77          }
78  
79          return super.equals(object);
80      }
81  
82      /*** @return the value for this parameter */
83      public String getValue()
84      {
85          return this.value;
86      }
87  
88      /*** Sets the value of this parameter.
89       *
90       * @param value the new parameter value
91       */
92      public void setValue(String value)
93      {
94          this.value = value;
95      }
96  
97      /*** @return the parameter's type */
98      public String getType()
99      {
100         return this.type;
101     }
102 
103     /*** Sets the type of this parameter.value.
104      *
105      * @param type the new parameter type
106      */
107     public void setType(String type)
108     {
109         this.type = type;
110     }
111 }