1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
19 package org.apache.commons.digester.rss;
20
21 import java.io.PrintWriter;
22 import java.io.Serializable;
23
24
25 /**
26 * <p>Implementation object representing an <strong>item</strong> in the
27 * <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
28 * to further specialize its behavior.</p>
29 */
30
31 public class Item implements Serializable {
32
33
34 // ------------------------------------------------------------- Properties
35
36
37 /**
38 * The item description (1-500 characters).
39 */
40 protected String description = null;
41
42 public String getDescription() {
43 return (this.description);
44 }
45
46 public void setDescription(String description) {
47 this.description = description;
48 }
49
50
51 /**
52 * The item link (1-500 characters).
53 */
54 protected String link = null;
55
56 public String getLink() {
57 return (this.link);
58 }
59
60 public void setLink(String link) {
61 this.link = link;
62 }
63
64
65 /**
66 * The item title (1-100 characters).
67 */
68 protected String title = null;
69
70 public String getTitle() {
71 return (this.title);
72 }
73
74 public void setTitle(String title) {
75 this.title = title;
76 }
77
78
79 // -------------------------------------------------------- Package Methods
80
81
82 /**
83 * Render this channel as XML conforming to the RSS 0.91 specification,
84 * to the specified writer.
85 *
86 * @param writer The writer to render output to
87 */
88 void render(PrintWriter writer) {
89
90 writer.println(" <item>");
91
92 writer.print(" <title>");
93 writer.print(title);
94 writer.println("</title>");
95
96 writer.print(" <link>");
97 writer.print(link);
98 writer.println("</link>");
99
100 if (description != null) {
101 writer.print(" <description>");
102 writer.print(description);
103 writer.println("</description>");
104 }
105
106 writer.println(" </item>");
107
108 }
109
110
111 }