View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
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 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   * @author Nick Lothian
30   */
31  public class SyndFeedInfo implements Cloneable, Serializable {
32      private ObjectBean _objBean;
33  	private String id;
34  	private URL url;
35  	private Object lastModified;
36  	private String eTag;
37  	private SyndFeed syndFeed;
38  
39      public SyndFeedInfo() {
40          _objBean = new ObjectBean(this.getClass(),this);
41      }
42  
43      /***
44       * Creates a deep 'bean' clone of the object.
45       * <p>
46       * @return a clone of the object.
47       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
48       *
49       */
50      public Object clone() throws CloneNotSupportedException {
51          return _objBean.clone();
52      }
53  
54      /***
55       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
56       * <p>
57       * @param other he reference object with which to compare.
58       * @return <b>true</b> if 'this' object is equal to the 'other' object.
59       *
60       */
61      public boolean equals(Object other) {
62          return _objBean.equals(other);
63      }
64  
65      /***
66       * Returns a hashcode value for the object.
67       * <p>
68       * It follows the contract defined by the Object hashCode() method.
69       * <p>
70       * @return the hashcode of the bean object.
71       *
72       */
73      public int hashCode() {
74          return _objBean.hashCode();
75      }
76  
77      /***
78       * Returns the String representation for the object.
79       * <p>
80       * @return String representation for the object.
81       *
82       */
83      public String toString() {
84          return _objBean.toString();
85      }
86  
87  
88  	/***
89  	 * @return the ETag the feed was last retrieved with
90  	 */
91  	public String getETag() {
92  		return eTag;
93  	}
94  
95  	/***
96  	 * @return the last modified date for the feed
97  	 */
98  	public Object getLastModified() {
99  		return lastModified;
100 	}
101 
102 	/***
103 	 * @return the URL the feed was served from
104 	 */
105 	public URL getUrl() {
106 		return url;
107 	}
108 
109 	public void setETag(String string) {
110 		eTag = string;
111 	}
112 
113 	public void setLastModified(Object o) {
114 		lastModified = o;
115 	}
116 
117 	public void setUrl(URL url) {
118 		this.url = url;
119 	}
120 
121 	public SyndFeed getSyndFeed() {
122 		return syndFeed;
123 	}
124 
125 	public void setSyndFeed(SyndFeed feed) {
126 		syndFeed = feed;
127 	}
128 
129 	/***
130 	 * @return A unique ID to identify the feed
131 	 */
132 	public String getId() {
133 		return id;
134 	}
135 
136 	/***
137 	 * @param string A unique ID to identify the feed. Note that if the URL of the feed
138 	 * changes this will remain the same
139 	 */
140 	public void setId(String string) {
141 		id = string;
142 	}
143 
144 }