001/* $Id: AudioVisual.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.catalog;
019
020import org.apache.commons.digester3.annotations.rules.ObjectCreate;
021import org.apache.commons.digester3.annotations.rules.SetProperty;
022
023/**
024 * @since 2.1
025 */
026@ObjectCreate.List( @ObjectCreate( pattern = "catalog/dvd" ) )
027public final class AudioVisual
028    implements Item
029{
030
031    @SetProperty( pattern = "catalog/dvd", attributeName = "year-made" )
032    private int yearMade;
033
034    private String category;
035
036    private String name;
037
038    private String desc;
039
040    private int runtime;
041
042    public int getYearMade()
043    {
044        return yearMade;
045    }
046
047    public void setYearMade( int yearMade )
048    {
049        this.yearMade = yearMade;
050    }
051
052    public String getCategory()
053    {
054        return this.category;
055    }
056
057    public void setCategory( String category )
058    {
059        this.category = category;
060    }
061
062    public String getName()
063    {
064        return this.name;
065    }
066
067    public void setName( String name )
068    {
069        this.name = name;
070    }
071
072    public String getDesc()
073    {
074        return this.desc;
075    }
076
077    public void setDesc( String desc )
078    {
079        this.desc = desc;
080    }
081
082    public int getRuntime()
083    {
084        return this.runtime;
085    }
086
087    public void setRuntime( int runtime )
088    {
089        this.runtime = runtime;
090    }
091
092    @Override
093    public boolean equals( Object obj )
094    {
095        if ( this == obj )
096            return true;
097        if ( obj == null )
098            return false;
099        if ( getClass() != obj.getClass() )
100            return false;
101        AudioVisual other = (AudioVisual) obj;
102        if ( this.category == null )
103        {
104            if ( other.getCategory() != null )
105                return false;
106        }
107        else if ( !this.category.equals( other.getCategory() ) )
108            return false;
109        if ( this.desc == null )
110        {
111            if ( other.getDesc() != null )
112                return false;
113        }
114        else if ( !this.desc.equals( other.getDesc() ) )
115            return false;
116        if ( this.name == null )
117        {
118            if ( other.getName() != null )
119                return false;
120        }
121        else if ( !this.name.equals( other.getName() ) )
122            return false;
123        if ( this.runtime != other.getRuntime() )
124            return false;
125        if ( this.yearMade != other.getYearMade() )
126            return false;
127        return true;
128    }
129
130    public void print()
131    {
132        System.out.println( this.toString() );
133    }
134
135}