1 package org.apache.commons.digester3.annotations.atom;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.net.URL;
23 import java.util.ArrayList;
24 import java.util.Date;
25 import java.util.List;
26
27 import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
28 import org.apache.commons.digester3.annotations.rules.CallMethod;
29 import org.apache.commons.digester3.annotations.rules.ObjectCreate;
30 import org.apache.commons.digester3.annotations.rules.SetNext;
31 import org.apache.commons.digester3.annotations.rules.SetProperty;
32
33 @ObjectCreate( pattern = "feed" )
34 public final class Feed
35 {
36
37 @BeanPropertySetter( pattern = "feed/title" )
38 private String title;
39
40 @SetProperty( pattern = "feed/link", attributeName = "href" )
41 private URL link;
42
43 @BeanPropertySetter( pattern = "feed/updated" )
44 private Date updated;
45
46 private final List<String> authors = new ArrayList<String>();
47
48 @BeanPropertySetter( pattern = "feed/id" )
49 private String id;
50
51 private final List<Entry> entries = new ArrayList<Entry>();
52
53 public String getTitle()
54 {
55 return title;
56 }
57
58 public void setTitle( String title )
59 {
60 this.title = title;
61 }
62
63 public URL getLink()
64 {
65 return link;
66 }
67
68 public void setLink( URL link )
69 {
70 this.link = link;
71 }
72
73 public Date getUpdated()
74 {
75 return updated;
76 }
77
78 public void setUpdated( Date updated )
79 {
80 this.updated = updated;
81 }
82
83 public String getId()
84 {
85 return id;
86 }
87
88 public void setId( String id )
89 {
90 this.id = id;
91 }
92
93 public List<String> getAuthors()
94 {
95 return authors;
96 }
97
98 @CallMethod( pattern = "feed/author/name", usingElementBodyAsArgument = true )
99 public void addAuthor( String author )
100 {
101 authors.add( author );
102 }
103
104 public List<Entry> getEntries()
105 {
106 return entries;
107 }
108
109 @SetNext
110 public void addEntry( Entry entry )
111 {
112 entries.add( entry );
113 }
114
115 @Override
116 public String toString()
117 {
118 return "Feed [title=" + title + ", link=" + link + ", updated=" + updated + ", authors=" + authors + ", id="
119 + id + ", entries=" + entries + "]";
120 }
121
122 }