Source code: com/sun/syndication/feed/synd/SyndEnclosureImpl.java
1 package com.sun.syndication.feed.synd;
2
3 import com.sun.syndication.feed.impl.ObjectBean;
4 import com.sun.syndication.feed.impl.CopyFromHelper;
5
6 import java.io.Serializable;
7 import java.util.Map;
8 import java.util.HashMap;
9 import java.util.Collections;
10
11 /**
12 * @author Alejandro Abdelnur
13 */
14 public class SyndEnclosureImpl implements Serializable,SyndEnclosure {
15 private ObjectBean _objBean;
16 private String _url;
17 private String _type;
18 private long _length;
19
20 /**
21 * Default constructor. All properties are set to <b>null</b>.
22 * <p>
23 *
24 */
25 public SyndEnclosureImpl() {
26 _objBean = new ObjectBean(SyndEnclosure.class,this);
27 }
28
29 /**
30 * Creates a deep 'bean' clone of the object.
31 * <p>
32 * @return a clone of the object.
33 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
34 *
35 */
36 public Object clone() throws CloneNotSupportedException {
37 return _objBean.clone();
38 }
39
40 /**
41 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
42 * <p>
43 * @param other he reference object with which to compare.
44 * @return <b>true</b> if 'this' object is equal to the 'other' object.
45 *
46 */
47 public boolean equals(Object other) {
48 return _objBean.equals(other);
49 }
50
51 /**
52 * Returns a hashcode value for the object.
53 * <p>
54 * It follows the contract defined by the Object hashCode() method.
55 * <p>
56 * @return the hashcode of the bean object.
57 *
58 */
59 public int hashCode() {
60 return _objBean.hashCode();
61 }
62
63 /**
64 * Returns the String representation for the object.
65 * <p>
66 * @return String representation for the object.
67 *
68 */
69 public String toString() {
70 return _objBean.toString();
71 }
72
73 /**
74 * Returns the enclosure URL.
75 * <p/>
76 *
77 * @return the enclosure URL, <b>null</b> if none.
78 */
79 public String getUrl() {
80 return _url;
81 }
82
83 /**
84 * Sets the enclosure URL.
85 * <p/>
86 *
87 * @param url the enclosure URL to set, <b>null</b> if none.
88 */
89 public void setUrl(String url) {
90 _url = url;
91 }
92
93 /**
94 * Returns the enclosure length.
95 * <p/>
96 *
97 * @return the enclosure length, <b>null</b> if none.
98 */
99 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,basePropInterfaceMap,basePropClassImplMap);
152 }
153
154 }