1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.fetcher.impl;
18
19 import java.io.Serializable;
20 import java.net.URL;
21
22 import com.sun.syndication.feed.impl.ObjectBean;
23 import com.sun.syndication.feed.synd.SyndFeed;
24
25 /***
26 * <p>A class to represent a {@link com.sun.syndication.feed.synd.SyndFeed}
27 * and some useful information about it.</p>
28 *
29 * <p>This class is thread safe, as expected by the different feed fetcher
30 * implementations.</p>
31 *
32 * @author Nick Lothian
33 */
34 public class SyndFeedInfo implements Cloneable, Serializable {
35 private static final long serialVersionUID = -1874786860901426015L;
36
37 private final ObjectBean _objBean;
38 private String id;
39 private URL url;
40 private Object lastModified;
41 private String eTag;
42 private SyndFeed syndFeed;
43
44 public SyndFeedInfo() {
45 _objBean = new ObjectBean(this.getClass(),this);
46 }
47
48 /***
49 * Creates a deep 'bean' clone of the object.
50 * <p>
51 * @return a clone of the object.
52 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
53 *
54 */
55 public Object clone() throws CloneNotSupportedException {
56 return _objBean.clone();
57 }
58
59 /***
60 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
61 * <p>
62 * @param other he reference object with which to compare.
63 * @return <b>true</b> if 'this' object is equal to the 'other' object.
64 *
65 */
66 public boolean equals(Object other) {
67 return _objBean.equals(other);
68 }
69
70 /***
71 * Returns a hashcode value for the object.
72 * <p>
73 * It follows the contract defined by the Object hashCode() method.
74 * <p>
75 * @return the hashcode of the bean object.
76 *
77 */
78 public int hashCode() {
79 return _objBean.hashCode();
80 }
81
82 /***
83 * Returns the String representation for the object.
84 * <p>
85 * @return String representation for the object.
86 *
87 */
88 public String toString() {
89 return _objBean.toString();
90 }
91
92
93 /***
94 * @return the ETag the feed was last retrieved with
95 */
96 public synchronized String getETag() {
97 return eTag;
98 }
99
100 /***
101 * @return the last modified date for the feed
102 */
103 public synchronized Object getLastModified() {
104 return lastModified;
105 }
106
107 /***
108 * @return the URL the feed was served from
109 */
110 public synchronized URL getUrl() {
111 return url;
112 }
113
114 public synchronized void setETag(String string) {
115 eTag = string;
116 }
117
118 public synchronized void setLastModified(Object o) {
119 lastModified = o;
120 }
121
122 public synchronized void setUrl(URL url) {
123 this.url = url;
124 }
125
126 public synchronized SyndFeed getSyndFeed() {
127 return syndFeed;
128 }
129
130 public synchronized void setSyndFeed(SyndFeed feed) {
131 syndFeed = feed;
132 }
133
134 /***
135 * @return A unique ID to identify the feed
136 */
137 public synchronized String getId() {
138 return id;
139 }
140
141 /***
142 * @param string A unique ID to identify the feed. Note that if the URL of the feed
143 * changes this will remain the same
144 */
145 public synchronized void setId(String string) {
146 id = string;
147 }
148
149 }