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.common.impl.CopyFromHelper;
21  
22  import java.util.Collections;
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  /***
27   * Bean for images of SyndFeedImpl feeds.
28   * <p>
29   * @author Alejandro Abdelnur
30   *
31   */
32  public class SyndImageImpl extends ObjectBean implements SyndImage {
33      private String _title;
34      private String _url;
35      private String _link;
36      private String _description;
37  
38      /***
39       * For implementations extending SyndImageImpl to be able to use the ObjectBean functionality
40       * with extended interfaces.
41       * <p>
42       * @param beanClass
43       */
44      protected SyndImageImpl(Class beanClass) {
45          super(beanClass);
46      }
47  
48  
49      /***
50       * Default constructor. All properties are set to <b>null</b>.
51       * <p>
52       *
53       */
54      public SyndImageImpl() {
55          this(SyndImage.class);
56      }
57  
58      /***
59       * Returns the image title.
60       * <p>
61       * @return the image title, <b>null</b> if none.
62       *
63       */
64      public String getTitle() {
65          return _title;
66      }
67  
68      /***
69       * Sets the image title.
70       * <p>
71       * @param title the image title to set, <b>null</b> if none.
72       *
73       */
74      public void setTitle(String title) {
75          _title = title;
76      }
77  
78      /***
79       * Returns the image URL.
80       * <p>
81       * @return the image URL, <b>null</b> if none.
82       *
83       */
84      public String getUrl() {
85          return _url;
86      }
87  
88      /***
89       * Sets the image URL.
90       * <p>
91       * @param url the image URL to set, <b>null</b> if none.
92       *
93       */
94      public void setUrl(String url) {
95          _url = url;
96      }
97  
98      /***
99       * Returns the image link.
100      * <p>
101      * @return the image link, <b>null</b> if none.
102      *
103      */
104     public String getLink() {
105         return _link;
106     }
107 
108     /***
109      * Sets the image link.
110      * <p>
111      * @param link the image link to set, <b>null</b> if none.
112      *
113      */
114     public void setLink(String link) {
115         _link = link;
116     }
117 
118     /***
119      * Returns the image description.
120      * <p>
121      * @return the image description, <b>null</b> if none.
122      *
123      */
124     public String getDescription() {
125         return _description;
126     }
127 
128     /***
129      * Sets the image description.
130      * <p>
131      * @param description the image description to set, <b>null</b> if none.
132      *
133      */
134     public void setDescription(String description) {
135         _description = description;
136     }
137 
138     public Class getInterface() {
139         return SyndImage.class;
140     }
141 
142     public void copyFrom(Object syndImage) {
143         COPY_FROM_HELPER.copy(this,syndImage);
144     }
145 
146     private static final CopyFromHelper COPY_FROM_HELPER;
147 
148     static {
149         Map basePropInterfaceMap = new HashMap();
150         basePropInterfaceMap.put("title",String.class);
151         basePropInterfaceMap.put("url",String.class);
152         basePropInterfaceMap.put("link",String.class);
153         basePropInterfaceMap.put("description",String.class);
154 
155         Map basePropClassImplMap = Collections.EMPTY_MAP;
156 
157         COPY_FROM_HELPER = new CopyFromHelper(SyndImage.class,basePropInterfaceMap,basePropClassImplMap);
158     }
159 
160 }