View Javadoc

1   /* $Id: Item.java 1102402 2011-05-12 18:03:26Z simonetripodi $
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one or more
4    * contributor license agreements.  See the NOTICE file distributed with
5    * this work for additional information regarding copyright ownership.
6    * The ASF licenses this file to You under the Apache License, Version 2.0
7    * (the "License"); you may not use this file except in compliance with
8    * the License.  You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.commons.digester3.annotations.rss;
19  
20  import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
21  import org.apache.commons.digester3.annotations.rules.ObjectCreate;
22  
23  /**
24   * @since 2.1
25   */
26  @ObjectCreate( pattern = "rss/channel/item" )
27  public final class Item
28  {
29  
30      @BeanPropertySetter( pattern = "rss/channel/item/description" )
31      private String description;
32  
33      @BeanPropertySetter( pattern = "rss/channel/item/link" )
34      private String link;
35  
36      @BeanPropertySetter( pattern = "rss/channel/item/title" )
37      private String title;
38  
39      public String getDescription()
40      {
41          return description;
42      }
43  
44      public void setDescription( String description )
45      {
46          this.description = description;
47      }
48  
49      public String getLink()
50      {
51          return link;
52      }
53  
54      public void setLink( String link )
55      {
56          this.link = link;
57      }
58  
59      public String getTitle()
60      {
61          return title;
62      }
63  
64      public void setTitle( String title )
65      {
66          this.title = title;
67      }
68  
69      @Override
70      public boolean equals( Object obj )
71      {
72          if ( this == obj )
73              return true;
74          if ( obj == null )
75              return false;
76          if ( getClass() != obj.getClass() )
77              return false;
78          Item other = (Item) obj;
79          if ( description == null )
80          {
81              if ( other.description != null )
82                  return false;
83          }
84          else if ( !description.equals( other.description ) )
85              return false;
86          if ( link == null )
87          {
88              if ( other.link != null )
89                  return false;
90          }
91          else if ( !link.equals( other.link ) )
92              return false;
93          if ( title == null )
94          {
95              if ( other.title != null )
96                  return false;
97          }
98          else if ( !title.equals( other.title ) )
99              return false;
100         return true;
101     }
102 
103     @Override
104     public String toString()
105     {
106         return "Item [description=" + description + ", link=" + link + ", title=" + title + "]";
107     }
108 
109 }