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