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:taylor@apache.org">David Sean Taylor</a>
27   * @version $Id: BaseCachedParameter.java,v 1.5 2004/02/23 03:08:26 jford Exp $
28   */
29  public class BaseCachedParameter extends BaseParameter
30      implements CachedParameter, java.io.Serializable
31  {
32      private boolean cachedOnName = true;
33      private boolean cachedOnValue = true;
34  
35      /***
36       * Implements the equals operation so that 2 elements are equal if
37       * all their member values are equal.
38       */
39      public boolean equals(Object object)
40      {
41          if (object==null)
42          {
43              return false;
44          }
45  
46          BaseCachedParameter obj = (BaseCachedParameter)object;
47  
48          if (cachedOnName != obj.getCachedOnName())
49          {
50              return false;
51          }
52  
53          if (cachedOnValue != obj.getCachedOnValue())
54          {
55              return false;
56          }
57  
58          return super.equals(object);
59      }
60  
61      public boolean isCachedOnName()
62      {
63          return cachedOnName;
64      }
65  
66      public boolean isCachedOnValue()
67      {
68          return cachedOnValue;
69      }
70  
71      public void setCachedOnName(boolean cached)
72      {
73          this.cachedOnName = cached;
74      }
75  
76      public void setCachedOnValue(boolean cached)
77      {
78          this.cachedOnValue = cached;
79      }
80  
81      // castor
82      public boolean getCachedOnName()
83      {
84          return cachedOnName;
85      }
86  
87      public boolean getCachedOnValue()
88      {
89          return cachedOnValue;
90      }
91  
92  }