001: /*
002: * Copyright 2004 Sun Microsystems, Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: *
016: */
017: package com.sun.syndication.feed.synd;
018:
019: import com.sun.syndication.feed.impl.ObjectBean;
020: import com.sun.syndication.feed.impl.CopyFromHelper;
021:
022: import java.util.Collections;
023: import java.util.HashMap;
024: import java.util.Map;
025: import java.io.Serializable;
026:
027: /**
028: * Bean for images of SyndFeedImpl feeds.
029: * <p>
030: * @author Alejandro Abdelnur
031: *
032: */
033: public class SyndImageImpl implements Serializable, SyndImage {
034: private ObjectBean _objBean;
035: private String _title;
036: private String _url;
037: private String _link;
038: private String _description;
039:
040: /**
041: * Default constructor. All properties are set to <b>null</b>.
042: * <p>
043: *
044: */
045: public SyndImageImpl() {
046: _objBean = new ObjectBean(SyndImage.class, this );
047: }
048:
049: /**
050: * Creates a deep 'bean' clone of the object.
051: * <p>
052: * @return a clone of the object.
053: * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
054: *
055: */
056: public Object clone() throws CloneNotSupportedException {
057: return _objBean.clone();
058: }
059:
060: /**
061: * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
062: * <p>
063: * @param other he reference object with which to compare.
064: * @return <b>true</b> if 'this' object is equal to the 'other' object.
065: *
066: */
067: public boolean equals(Object other) {
068: return _objBean.equals(other);
069: }
070:
071: /**
072: * Returns a hashcode value for the object.
073: * <p>
074: * It follows the contract defined by the Object hashCode() method.
075: * <p>
076: * @return the hashcode of the bean object.
077: *
078: */
079: public int hashCode() {
080: return _objBean.hashCode();
081: }
082:
083: /**
084: * Returns the String representation for the object.
085: * <p>
086: * @return String representation for the object.
087: *
088: */
089: public String toString() {
090: return _objBean.toString();
091: }
092:
093: /**
094: * Returns the image title.
095: * <p>
096: * @return the image title, <b>null</b> if none.
097: *
098: */
099: public String getTitle() {
100: return _title;
101: }
102:
103: /**
104: * Sets the image title.
105: * <p>
106: * @param title the image title to set, <b>null</b> if none.
107: *
108: */
109: public void setTitle(String title) {
110: _title = title;
111: }
112:
113: /**
114: * Returns the image URL.
115: * <p>
116: * @return the image URL, <b>null</b> if none.
117: *
118: */
119: public String getUrl() {
120: return _url;
121: }
122:
123: /**
124: * Sets the image URL.
125: * <p>
126: * @param url the image URL to set, <b>null</b> if none.
127: *
128: */
129: public void setUrl(String url) {
130: _url = url;
131: }
132:
133: /**
134: * Returns the image link.
135: * <p>
136: * @return the image link, <b>null</b> if none.
137: *
138: */
139: public String getLink() {
140: return _link;
141: }
142:
143: /**
144: * Sets the image link.
145: * <p>
146: * @param link the image link to set, <b>null</b> if none.
147: *
148: */
149: public void setLink(String link) {
150: _link = link;
151: }
152:
153: /**
154: * Returns the image description.
155: * <p>
156: * @return the image description, <b>null</b> if none.
157: *
158: */
159: public String getDescription() {
160: return _description;
161: }
162:
163: /**
164: * Sets the image description.
165: * <p>
166: * @param description the image description to set, <b>null</b> if none.
167: *
168: */
169: public void setDescription(String description) {
170: _description = description;
171: }
172:
173: public Class getInterface() {
174: return SyndImage.class;
175: }
176:
177: public void copyFrom(Object syndImage) {
178: COPY_FROM_HELPER.copy(this , syndImage);
179: }
180:
181: private static final CopyFromHelper COPY_FROM_HELPER;
182:
183: static {
184: Map basePropInterfaceMap = new HashMap();
185: basePropInterfaceMap.put("title", String.class);
186: basePropInterfaceMap.put("url", String.class);
187: basePropInterfaceMap.put("link", String.class);
188: basePropInterfaceMap.put("description", String.class);
189:
190: Map basePropClassImplMap = Collections.EMPTY_MAP;
191:
192: COPY_FROM_HELPER = new CopyFromHelper(SyndImage.class,
193: basePropInterfaceMap, basePropClassImplMap);
194: }
195:
196: }
|