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  /***
20   * Utility object for serializing with Castor a MediaTypeEntry reference
21   *
22   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
23   * @version $Id: BaseMediaType.java,v 1.3 2004/02/23 03:08:26 jford Exp $
24   */
25  public class BaseMediaType implements java.io.Serializable
26  {
27  
28      private String name;
29  
30      /***
31       * Implements the equals operation so that 2 elements are equal if
32       * all their member values are equal.
33       */
34      public boolean equals(Object object)
35      {
36          if (object==null)
37          {
38              return false;
39          }
40  
41          BaseMediaType obj = (BaseMediaType)object;
42  
43          if (name!=null)
44          {
45              return name.equals(obj.getRef());
46          }
47          else
48          {
49              if (obj.getRef()!=null)
50              {
51                  return false;
52              }
53          }
54  
55          return true;
56      }
57  
58      /*** @return the media type name that is referenced */
59      public String getRef()
60      {
61          return this.name;
62      }
63  
64      /*** Sets the media type name referenced by this object
65       * @param name the required media type name
66       */
67      public void setRef( String name )
68      {
69          this.name = name;
70      }
71  
72  }