1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.feed.synd;
18
19 import com.sun.syndication.feed.impl.ObjectBean;
20 import com.sun.syndication.feed.impl.CopyFromHelper;
21
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.Map;
25 import java.io.Serializable;
26
27 /***
28 * Bean for content of SyndFeedImpl entries.
29 * <p>
30 * @author Alejandro Abdelnur
31 *
32 */
33 public class SyndContentImpl implements Serializable,SyndContent {
34 private ObjectBean _objBean;
35 private String _type;
36 private String _value;
37 private String _mode;
38
39
40 /***
41 * Default constructor. All properties are set to <b>null</b>.
42 * <p>
43 *
44 */
45 public SyndContentImpl() {
46 _objBean = new ObjectBean(SyndContent.class,this);
47 }
48
49 /***
50 * Creates a deep 'bean' clone of the object.
51 * <p>
52 * @return a clone of the object.
53 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
54 *
55 */
56 public Object clone() throws CloneNotSupportedException {
57 return _objBean.clone();
58 }
59
60 /***
61 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
62 * <p>
63 * @param other he reference object with which to compare.
64 * @return <b>true</b> if 'this' object is equal to the 'other' object.
65 *
66 */
67 public boolean equals(Object other) {
68 return _objBean.equals(other);
69 }
70
71 /***
72 * Returns a hashcode value for the object.
73 * <p>
74 * It follows the contract defined by the Object hashCode() method.
75 * <p>
76 * @return the hashcode of the bean object.
77 *
78 */
79 public int hashCode() {
80 return _objBean.hashCode();
81 }
82
83 /***
84 * Returns the String representation for the object.
85 * <p>
86 * @return String representation for the object.
87 *
88 */
89 public String toString() {
90 return _objBean.toString();
91 }
92
93 /***
94 * Returns the content type.
95 * <p>
96 * When used for the description of an entry, if <b>null</b> 'text/plain' must be assumed.
97 * <p>
98 * @return the content type, <b>null</b> if none.
99 *
100 */
101 public String getType() {
102 return _type;
103 }
104
105 /***
106 * Sets the content type.
107 * <p>
108 * When used for the description of an entry, if <b>null</b> 'text/plain' must be assumed.
109 * <p>
110 * @param type the content type to set, <b>null</b> if none.
111 *
112 */
113 public void setType(String type) {
114 _type = type;
115 }
116
117 /***
118 * Returns the content mode.
119 * @return the content mode, <b>null</b> if none.
120 *
121 */
122 public String getMode() {
123 return _mode;
124 }
125
126 /***
127 * Sets the content mode.
128 * @param type the content mode to set, <b>null</b> if none.
129 *
130 */
131 public void setMode(String mode) {
132 _mode = mode;
133 }
134
135 /***
136 * Returns the content value.
137 * <p>
138 * @return the content value, <b>null</b> if none.
139 *
140 */
141 public String getValue() {
142 return _value;
143 }
144
145 /***
146 * Sets the content value.
147 * <p>
148 * @param value the content value to set, <b>null</b> if none.
149 *
150 */
151 public void setValue(String value) {
152 _value = value;
153 }
154
155
156 public Class getInterface() {
157 return SyndContent.class;
158 }
159
160 public void copyFrom(Object obj) {
161 COPY_FROM_HELPER.copy(this,obj);
162 }
163
164 private static final CopyFromHelper COPY_FROM_HELPER;
165
166 static {
167 Map basePropInterfaceMap = new HashMap();
168 basePropInterfaceMap.put("type",String.class);
169 basePropInterfaceMap.put("value",String.class);
170
171 Map basePropClassImplMap = Collections.EMPTY_MAP;
172
173 COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class,basePropInterfaceMap,basePropClassImplMap);
174 }
175
176 }