001package org.apache.commons.digester3.rss;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one or more
005 * contributor license agreements.  See the NOTICE file distributed with
006 * this work for additional information regarding copyright ownership.
007 * The ASF licenses this file to You under the Apache License, Version 2.0
008 * (the "License"); you may not use this file except in compliance with
009 * the License.  You may obtain a copy of the License at
010 * 
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 * 
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020import java.io.PrintWriter;
021import java.io.Serializable;
022
023/**
024 * <p>Implementation object representing an <strong>item</strong> in the
025 * <em>Rich Site Summary</em> DTD, version 0.91.  This class may be subclassed
026 * to further specialize its behavior.</p>
027 */
028public class Item implements Serializable {
029
030    /**
031     * 
032     */
033    private static final long serialVersionUID = -2535241576243936839L;
034
035    // ------------------------------------------------------------- Properties
036
037    /**
038     * The item description (1-500 characters).
039     */
040    protected String description = null;
041
042    public String getDescription()
043    {
044        return ( this.description );
045    }
046
047    public void setDescription( String description )
048    {
049        this.description = description;
050    }
051
052    /**
053     * The item link (1-500 characters).
054     */
055    protected String link = null;
056
057    public String getLink()
058    {
059        return ( this.link );
060    }
061
062    public void setLink( String link )
063    {
064        this.link = link;
065    }
066
067    /**
068     * The item title (1-100 characters).
069     */
070    protected String title = null;
071
072    public String getTitle()
073    {
074        return ( this.title );
075    }
076
077    public void setTitle( String title )
078    {
079        this.title = title;
080    }
081
082    // -------------------------------------------------------- Package Methods
083
084    /**
085     * Render this channel as XML conforming to the RSS 0.91 specification,
086     * to the specified writer.
087     *
088     * @param writer The writer to render output to
089     */
090    void render( PrintWriter writer )
091    {
092        writer.println( "    <item>" );
093
094        writer.print( "      <title>" );
095        writer.print( title );
096        writer.println( "</title>" );
097
098        writer.print( "      <link>" );
099        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}