001/* $Id: Item.java 1102402 2011-05-12 18:03:26Z simonetripodi $
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements.  See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.commons.digester3.annotations.rss;
019
020import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
021import org.apache.commons.digester3.annotations.rules.ObjectCreate;
022
023/**
024 * @since 2.1
025 */
026@ObjectCreate( pattern = "rss/channel/item" )
027public final class Item
028{
029
030    @BeanPropertySetter( pattern = "rss/channel/item/description" )
031    private String description;
032
033    @BeanPropertySetter( pattern = "rss/channel/item/link" )
034    private String link;
035
036    @BeanPropertySetter( pattern = "rss/channel/item/title" )
037    private String title;
038
039    public String getDescription()
040    {
041        return description;
042    }
043
044    public void setDescription( String description )
045    {
046        this.description = description;
047    }
048
049    public String getLink()
050    {
051        return link;
052    }
053
054    public void setLink( String link )
055    {
056        this.link = link;
057    }
058
059    public String getTitle()
060    {
061        return title;
062    }
063
064    public void setTitle( String title )
065    {
066        this.title = title;
067    }
068
069    @Override
070    public boolean equals( Object obj )
071    {
072        if ( this == obj )
073            return true;
074        if ( obj == null )
075            return false;
076        if ( getClass() != obj.getClass() )
077            return false;
078        Item other = (Item) obj;
079        if ( description == null )
080        {
081            if ( other.description != null )
082                return false;
083        }
084        else if ( !description.equals( other.description ) )
085            return false;
086        if ( link == null )
087        {
088            if ( other.link != null )
089                return false;
090        }
091        else if ( !link.equals( other.link ) )
092            return false;
093        if ( title == null )
094        {
095            if ( other.title != null )
096                return false;
097        }
098        else if ( !title.equals( other.title ) )
099            return false;
100        return true;
101    }
102
103    @Override
104    public String toString()
105    {
106        return "Item [description=" + description + ", link=" + link + ", title=" + title + "]";
107    }
108
109}