001: package com.sun.syndication.feed.synd;
002:
003: import com.sun.syndication.feed.impl.ObjectBean;
004: import com.sun.syndication.feed.impl.CopyFromHelper;
005:
006: import java.io.Serializable;
007: import java.util.Map;
008: import java.util.HashMap;
009: import java.util.Collections;
010:
011: /**
012: * @author Alejandro Abdelnur
013: */
014: public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
015: private ObjectBean _objBean;
016: private String _url;
017: private String _type;
018: private long _length;
019:
020: /**
021: * Default constructor. All properties are set to <b>null</b>.
022: * <p>
023: *
024: */
025: public SyndEnclosureImpl() {
026: _objBean = new ObjectBean(SyndEnclosure.class, this );
027: }
028:
029: /**
030: * Creates a deep 'bean' clone of the object.
031: * <p>
032: * @return a clone of the object.
033: * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
034: *
035: */
036: public Object clone() throws CloneNotSupportedException {
037: return _objBean.clone();
038: }
039:
040: /**
041: * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
042: * <p>
043: * @param other he reference object with which to compare.
044: * @return <b>true</b> if 'this' object is equal to the 'other' object.
045: *
046: */
047: public boolean equals(Object other) {
048: return _objBean.equals(other);
049: }
050:
051: /**
052: * Returns a hashcode value for the object.
053: * <p>
054: * It follows the contract defined by the Object hashCode() method.
055: * <p>
056: * @return the hashcode of the bean object.
057: *
058: */
059: public int hashCode() {
060: return _objBean.hashCode();
061: }
062:
063: /**
064: * Returns the String representation for the object.
065: * <p>
066: * @return String representation for the object.
067: *
068: */
069: public String toString() {
070: return _objBean.toString();
071: }
072:
073: /**
074: * Returns the enclosure URL.
075: * <p/>
076: *
077: * @return the enclosure URL, <b>null</b> if none.
078: */
079: public String getUrl() {
080: return _url;
081: }
082:
083: /**
084: * Sets the enclosure URL.
085: * <p/>
086: *
087: * @param url the enclosure URL to set, <b>null</b> if none.
088: */
089: public void setUrl(String url) {
090: _url = url;
091: }
092:
093: /**
094: * Returns the enclosure length.
095: * <p/>
096: *
097: * @return the enclosure length, <b>null</b> if none.
098: */
099: public long getLength() {
100: return _length;
101: }
102:
103: /**
104: * Sets the enclosure length.
105: * <p/>
106: *
107: * @param length the enclosure length to set, <b>null</b> if none.
108: */
109: public void setLength(long length) {
110: _length = length;
111: }
112:
113: /**
114: * Returns the enclosure type.
115: * <p/>
116: *
117: * @return the enclosure type, <b>null</b> if none.
118: */
119: public String getType() {
120: return _type;
121: }
122:
123: /**
124: * Sets the enclosure type.
125: * <p/>
126: *
127: * @param type the enclosure type to set, <b>null</b> if none.
128: */
129: public void setType(String type) {
130: _type = type;
131: }
132:
133: public Class getInterface() {
134: return SyndEnclosure.class;
135: }
136:
137: public void copyFrom(Object obj) {
138: COPY_FROM_HELPER.copy(this , obj);
139: }
140:
141: private static final CopyFromHelper COPY_FROM_HELPER;
142:
143: static {
144: Map basePropInterfaceMap = new HashMap();
145: basePropInterfaceMap.put("url", String.class);
146: basePropInterfaceMap.put("type", String.class);
147: basePropInterfaceMap.put("length", Long.TYPE);
148:
149: Map basePropClassImplMap = Collections.EMPTY_MAP;
150:
151: COPY_FROM_HELPER = new CopyFromHelper(SyndEnclosure.class,
152: basePropInterfaceMap, basePropClassImplMap);
153: }
154:
155: }
|