View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package com.sun.syndication.feed.synd;
18  
19  import com.sun.syndication.common.ObjectBean;
20  import com.sun.syndication.feed.synd.impl.SyndCopyFrom;
21  
22  import java.util.HashMap;
23  import java.util.Map;
24  import java.util.Collections;
25  
26  /***
27   * Bean for content of SyndFeed entries.
28   * <p>
29   * @author Alejandro Abdelnur
30   *
31   */
32  public class SyndContent extends ObjectBean implements SyndContentI {
33      private String _type;
34      private String _value;
35  
36      /***
37       * Default constructor. All properties are set to <b>null</b>.
38       * <p>
39       *
40       */
41      public SyndContent() {
42          super(SyndContentI.class);
43      }
44  
45      /***
46       * Returns the content type.
47       * <p>
48       * When used for the description of an entry, if <b>null</b> 'text/plain' must be assumed.
49       * <p>
50       * @return the content type, <b>null</b> if none.
51       *
52       */
53      public String getType() {
54          return _type;
55      }
56  
57      /***
58       * Sets the content type.
59       * <p>
60       * When used for the description of an entry, if <b>null</b> 'text/plain' must be assumed.
61       * <p>
62       * @param type the content type to set, <b>null</b> if none.
63       *
64       */
65      public void setType(String type) {
66          _type = type;
67      }
68  
69      /***
70       * Returns the content value.
71       * <p>
72       * @return the content value, <b>null</b> if none.
73       *
74       */
75      public String getValue() {
76          return _value;
77      }
78  
79      /***
80       * Sets the content value.
81       * <p>
82       * @param value the content value to set, <b>null</b> if none.
83       *
84       */
85      public void setValue(String value) {
86          _value = value;
87      }
88  
89  
90      public Class getInterface() {
91          return SyndContentI.class;
92      }
93  
94      public void copyFrom(Object obj) {
95          SYND_COPY_FROM.copy(this,obj);
96      }
97  
98      private static final SyndCopyFrom SYND_COPY_FROM;
99  
100     static {
101         Map basePropInterfaceMap = new HashMap();
102         basePropInterfaceMap.put("type",String.class);
103         basePropInterfaceMap.put("value",String.class);
104 
105         Map basePropClassImplMap = Collections.EMPTY_MAP;
106 
107         SYND_COPY_FROM = new SyndCopyFrom(SyndContentI.class,basePropInterfaceMap,basePropClassImplMap);
108     }
109 
110 }