View Javadoc
1   /*
2    * The MIT License
3    * Copyright © 2004-2014 Fabrizio Giustina
4    * Copyright © 2022-2022 Web-Legacy
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy
7    * of this software and associated documentation files (the "Software"), to deal
8    * in the Software without restriction, including without limitation the rights
9    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10   * copies of the Software, and to permit persons to whom the Software is
11   * furnished to do so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in
14   * all copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22   * THE SOFTWARE.
23   */
24  package net.sf.maventaglib.checker;
25  
26  import org.apache.commons.lang3.builder.CompareToBuilder;
27  import org.apache.commons.lang3.builder.EqualsBuilder;
28  import org.apache.commons.lang3.builder.HashCodeBuilder;
29  
30  /**
31   * @author fgiust
32   * @version $Id: TagFile.java 217 2014-08-15 20:50:32Z fgiust $
33   */
34  public class TagFile extends TldItem
35  {
36  
37      private String path;
38  
39      /**
40       * Returns the path.
41       * @return the path
42       */
43      public String getPath()
44      {
45          return path;
46      }
47  
48      /**
49       * Sets the path.
50       * @param path the path to set
51       */
52      public void setPath(String path)
53      {
54          this.path = path;
55      }
56  
57      /**
58       * @see java.lang.Comparable#compareTo(Object)
59       */
60      @Override
61      public int compareTo(TldItem object)
62      {
63          int ret = super.compareTo(object);
64          if (ret != 0) {
65              return ret;
66          }
67  
68          TagFile rhs = (TagFile) object;
69          return new CompareToBuilder()
70              .appendSuper(super.compareTo(object))
71              .append(this.path, rhs.path)
72              .toComparison();
73      }
74  
75      /**
76       * @see java.lang.Object#equals(Object)
77       */
78      @Override
79      public boolean equals(Object obj)
80      {
81          if(obj == null || !super.equals(obj))
82          {
83              return false;
84          }
85  
86          TagFile rhs = (TagFile) obj;
87          return new EqualsBuilder()
88                  .appendSuper(super.equals(obj))
89                  .append(this.path, rhs.path)
90                  .isEquals();
91        }
92  
93      /**
94       * @see java.lang.Object#hashCode()
95       */
96      @Override
97      public int hashCode() {
98          return new HashCodeBuilder()
99                  .appendSuper(super.hashCode())
100                 .append(this.path)
101                 .toHashCode();
102       }
103 
104 }