1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.feed.atom;
18
19 import com.sun.syndication.feed.impl.ObjectBean;
20
21 import java.io.Serializable;
22
23 /***
24 * Bean for link elements of Atom feeds.
25 * <p>
26 * @author Alejandro Abdelnur
27 * @author Dave Johnson (updated for Atom 1.0)
28 */
29 public class Link implements Cloneable,Serializable {
30
31 private ObjectBean _objBean;
32
33 private String _href;
34 private String _hrefResolved;
35 private String _rel = "alternate";
36 private String _type;
37 private String _hreflang;
38 private String _title;
39 private long _length;
40
41 /***
42 * Default constructor. All properties are set to <b>null</b>.
43 * <p>
44 *
45 */
46 public Link() {
47 _objBean = new ObjectBean(this.getClass(),this);
48 }
49
50 /***
51 * Creates a deep 'bean' clone of the object.
52 * <p>
53 * @return a clone of the object.
54 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
55 *
56 */
57 public Object clone() throws CloneNotSupportedException {
58 return _objBean.clone();
59 }
60
61 /***
62 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
63 * <p>
64 * @param other he reference object with which to compare.
65 * @return <b>true</b> if 'this' object is equal to the 'other' object.
66 *
67 */
68 public boolean equals(Object other) {
69 return _objBean.equals(other);
70 }
71
72 /***
73 * Returns a hashcode value for the object.
74 * <p>
75 * It follows the contract defined by the Object hashCode() method.
76 * <p>
77 * @return the hashcode of the bean object.
78 *
79 */
80 public int hashCode() {
81 return _objBean.hashCode();
82 }
83
84 /***
85 * Returns the String representation for the object.
86 * <p>
87 * @return String representation for the object.
88 *
89 */
90 public String toString() {
91 return _objBean.toString();
92 }
93
94 /***
95 * Returns the link rel.
96 * <p>
97 * @return the link rel, <b>null</b> if none.
98 *
99 */
100 public String getRel() {
101 return _rel;
102 }
103
104 /***
105 * Sets the link rel.
106 * <p>
107 * @param rel the link rel,, <b>null</b> if none.
108 *
109 */
110 public void setRel(String rel) {
111
112 _rel = rel;
113 }
114
115 /***
116 * Returns the link type.
117 * <p>
118 * @return the link type, <b>null</b> if none.
119 *
120 */
121 public String getType() {
122 return _type;
123 }
124
125 /***
126 * Sets the link type.
127 * <p>
128 * @param type the link type, <b>null</b> if none.
129 *
130 */
131 public void setType(String type) {
132 _type = type;
133 }
134
135 /***
136 * Returns the link href.
137 * <p>
138 * @return the link href, <b>null</b> if none.
139 *
140 */
141 public String getHref() {
142 return _href;
143 }
144
145 /***
146 * Sets the link href.
147 * <p>
148 * @param href the link href, <b>null</b> if none.
149 *
150 */
151 public void setHref(String href) {
152 _href = href;
153 }
154
155 public void setHrefResolved(String hrefResolved) {
156 _hrefResolved = hrefResolved;
157 }
158
159 public String getHrefResolved() {
160 return _hrefResolved != null ? _hrefResolved : _href;
161 }
162
163 /***
164 * Returns the link title.
165 * <p>
166 * @return the link title, <b>null</b> if none.
167 *
168 */
169 public String getTitle() {
170 return _title;
171 }
172
173 /***
174 * Sets the link title.
175 * <p>
176 * @param title the link title, <b>null</b> if none.
177 *
178 */
179 public void setTitle(String title) {
180 _title = title;
181 }
182
183 /***
184 * Returns the hreflang
185 * <p>
186 * @return Returns the hreflang.
187 * @since Atom 1.0
188 */
189 public String getHreflang() {
190 return _hreflang;
191 }
192
193 /***
194 * Set the hreflang
195 * <p>
196 * @param hreflang The hreflang to set.
197 * @since Atom 1.0
198 */
199 public void setHreflang(String hreflang) {
200 _hreflang = hreflang;
201 }
202
203 /***
204 * Returns the length
205 * <p>
206 * @return Returns the length.
207 */
208 public long getLength() {
209 return _length;
210 }
211
212 /***
213 * Set the length
214 * <p>
215 * @param length The length to set.
216 */
217 public void setLength(long length) {
218 _length = length;
219 }
220 }