1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.digester3.annotations.rss;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23 import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
24 import org.apache.commons.digester3.annotations.rules.ObjectCreate;
25 import org.apache.commons.digester3.annotations.rules.SetNext;
26
27
28
29
30 @ObjectCreate( pattern = "rss/channel" )
31 public final class Channel
32 {
33
34 private final List<Item> items = new ArrayList<Item>();
35
36 @BeanPropertySetter( pattern = "rss/channel/title" )
37 private String title;
38
39 @BeanPropertySetter( pattern = "rss/channel/link" )
40 private String link;
41
42 @BeanPropertySetter( pattern = "rss/channel/description" )
43 private String description;
44
45 @BeanPropertySetter( pattern = "rss/channel/language" )
46 private String language;
47
48 private Image image;
49
50 public String getTitle()
51 {
52 return title;
53 }
54
55 public void setTitle( String title )
56 {
57 this.title = title;
58 }
59
60 public String getLink()
61 {
62 return link;
63 }
64
65 public void setLink( String link )
66 {
67 this.link = link;
68 }
69
70 public String getDescription()
71 {
72 return description;
73 }
74
75 public void setDescription( String description )
76 {
77 this.description = description;
78 }
79
80 public String getLanguage()
81 {
82 return language;
83 }
84
85 public void setLanguage( String language )
86 {
87 this.language = language;
88 }
89
90 public List<Item> getItems()
91 {
92 return items;
93 }
94
95 public Image getImage()
96 {
97 return image;
98 }
99
100 @SetNext
101 public void setImage( Image image )
102 {
103 this.image = image;
104 }
105
106 @SetNext
107 public void addItem( Item item )
108 {
109 this.items.add( item );
110 }
111
112 @Override
113 public boolean equals( Object obj )
114 {
115 if ( this == obj )
116 return true;
117 if ( obj == null )
118 return false;
119 if ( getClass() != obj.getClass() )
120 return false;
121 Channel other = (Channel) obj;
122 if ( description == null )
123 {
124 if ( other.description != null )
125 return false;
126 }
127 else if ( !description.equals( other.description ) )
128 return false;
129 if ( image == null )
130 {
131 if ( other.image != null )
132 return false;
133 }
134 else if ( !image.equals( other.image ) )
135 return false;
136 if ( items == null )
137 {
138 if ( other.items != null )
139 return false;
140 }
141 else if ( !items.equals( other.items ) )
142 return false;
143 if ( language == null )
144 {
145 if ( other.language != null )
146 return false;
147 }
148 else if ( !language.equals( other.language ) )
149 return false;
150 if ( link == null )
151 {
152 if ( other.link != null )
153 return false;
154 }
155 else if ( !link.equals( other.link ) )
156 return false;
157 if ( title == null )
158 {
159 if ( other.title != null )
160 return false;
161 }
162 else if ( !title.equals( other.title ) )
163 return false;
164 return true;
165 }
166
167 @Override
168 public String toString()
169 {
170 return "Channel [description=" + description + ", image=" + image + ", items=" + items + ", language="
171 + language + ", link=" + link + ", title=" + title + "]";
172 }
173
174 }