KickJava   Java API By Example, From Geeks To Geeks.

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


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 Metainfo interface suitable for
23  * Castor serialization.
24  *
25  * @see org.apache.jetspeed.om.registry.MetaInfo
26  * @author <a HREF="mailto:raphael@apache.org">Raphaël Luta</a>
27  * @version $Id: BaseMetaInfo.java,v 1.4 2004/02/23 03:08:26 jford Exp $
28  */

29 public class BaseMetaInfo implements MetaInfo, java.io.Serializable JavaDoc
30 {
31     private String JavaDoc title;
32
33     private String JavaDoc description;
34
35     private String JavaDoc image;
36
37     public BaseMetaInfo()
38     {}
39
40     public BaseMetaInfo(String JavaDoc title, String JavaDoc description, String JavaDoc image)
41     {
42         this.title = title;
43         this.description = description;
44         this.image = image;
45     }
46
47     /**
48      * Implements the equals operation so that 2 elements are equal if
49      * all their member values are equal.
50      */

51     public boolean equals(Object JavaDoc object)
52     {
53         if (object==null)
54         {
55             return false;
56         }
57
58         BaseMetaInfo obj = (BaseMetaInfo)object;
59
60         if (title!=null)
61         {
62             if (!title.equals(obj.getTitle()))
63             {
64                 return false;
65             }
66         }
67         else
68         {
69             if (obj.getTitle()!=null)
70             {
71                 return false;
72             }
73         }
74
75         if (description!=null)
76         {
77             if(!description.equals(obj.getDescription()))
78             {
79                 return false;
80             }
81         }
82         else
83         {
84             if (obj.getDescription()!=null)
85             {
86                 return false;
87             }
88         }
89
90         if (image!=null)
91         {
92             if(!image.equals(obj.getImage()))
93             {
94                 return false;
95             }
96         }
97         else
98         {
99             if (obj.getImage()!=null)
100             {
101                 return false;
102             }
103         }
104
105         return true;
106     }
107
108     /** @return the title for this entry */
109     public String JavaDoc getTitle()
110     {
111         return this.title;
112     }
113
114     /** Sets the title for this entry
115      * @param title the new title for this entry
116      */

117     public void setTitle( String JavaDoc title )
118     {
119         this.title = title;
120     }
121
122     /** @return the description for this entry */
123     public String JavaDoc getDescription()
124     {
125         return this.description;
126     }
127
128     /** Sets the description for this entry
129      * @param description the new description for this entry
130      */

131     public void setDescription( String JavaDoc description )
132     {
133         this.description = description;
134     }
135
136     /** @return the image link for this entry */
137     public String JavaDoc getImage()
138     {
139         return this.image;
140     }
141
142     /** Sets the image URL attached to this entry
143      * @param image the image URL to link to this entry
144      */

145     public void setImage( String JavaDoc image )
146     {
147         this.image = image;
148     }
149
150 }
151
Popular Tags