View Javadoc

1   /* $Id: AudioVisual.java 1102402 2011-05-12 18:03:26Z simonetripodi $
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one or more
4    * contributor license agreements.  See the NOTICE file distributed with
5    * this work for additional information regarding copyright ownership.
6    * The ASF licenses this file to You under the Apache License, Version 2.0
7    * (the "License"); you may not use this file except in compliance with
8    * the License.  You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.commons.digester3.annotations.catalog;
19  
20  import org.apache.commons.digester3.annotations.rules.ObjectCreate;
21  import org.apache.commons.digester3.annotations.rules.SetProperty;
22  
23  /**
24   * @since 2.1
25   */
26  @ObjectCreate.List( @ObjectCreate( pattern = "catalog/dvd" ) )
27  public final class AudioVisual
28      implements Item
29  {
30  
31      @SetProperty( pattern = "catalog/dvd", attributeName = "year-made" )
32      private int yearMade;
33  
34      private String category;
35  
36      private String name;
37  
38      private String desc;
39  
40      private int runtime;
41  
42      public int getYearMade()
43      {
44          return yearMade;
45      }
46  
47      public void setYearMade( int yearMade )
48      {
49          this.yearMade = yearMade;
50      }
51  
52      public String getCategory()
53      {
54          return this.category;
55      }
56  
57      public void setCategory( String category )
58      {
59          this.category = category;
60      }
61  
62      public String getName()
63      {
64          return this.name;
65      }
66  
67      public void setName( String name )
68      {
69          this.name = name;
70      }
71  
72      public String getDesc()
73      {
74          return this.desc;
75      }
76  
77      public void setDesc( String desc )
78      {
79          this.desc = desc;
80      }
81  
82      public int getRuntime()
83      {
84          return this.runtime;
85      }
86  
87      public void setRuntime( int runtime )
88      {
89          this.runtime = runtime;
90      }
91  
92      @Override
93      public boolean equals( Object obj )
94      {
95          if ( this == obj )
96              return true;
97          if ( obj == null )
98              return false;
99          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 }