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  import org.apache.commons.lang3.builder.ToStringBuilder;
30  import org.apache.commons.lang3.builder.ToStringStyle;
31  
32  /**
33   * Javabean representing a tag attribute.
34   * @author Fabrizio Giustina
35   * @version $Revision: 217 $ ($Author: fgiust $)
36   */
37  public class TagVariable
38      implements Comparable<TagVariable>
39  {
40      private String nameGiven;
41  
42      private String nameFromAttribute;
43  
44      private String type;
45  
46      private String scope;
47  
48      private String description;
49  
50      private boolean deprecated;
51  
52      public String getDescription()
53      {
54          return this.description;
55      }
56  
57      public void setDescription( String description )
58      {
59          this.description = description;
60      }
61  
62      public String getNameGiven()
63      {
64          return this.nameGiven;
65      }
66  
67      public void setNameGiven( String name )
68      {
69          this.nameGiven = name;
70      }
71  
72      public String getScope()
73      {
74          return this.scope;
75      }
76  
77      public void setScope( String scope )
78      {
79          this.scope = scope;
80      }
81  
82      public String getType()
83      {
84          return this.type;
85      }
86  
87      public void setType( String type )
88      {
89          this.type = type;
90      }
91  
92      public String getNameFromAttribute()
93      {
94          return this.nameFromAttribute;
95      }
96  
97      public void setNameFromAttribute( String nameFromAttribute )
98      {
99          this.nameFromAttribute = nameFromAttribute;
100     }
101 
102     public boolean isDeprecated()
103     {
104         return this.deprecated;
105     }
106 
107     public void setDeprecated( boolean deprecated )
108     {
109         this.deprecated = deprecated;
110     }
111 
112     /**
113      * @see java.lang.Object#toString()
114      */
115     @Override
116     public String toString()
117     {
118         return new ToStringBuilder( this, ToStringStyle.SHORT_PREFIX_STYLE ).append( "nameGiven", this.nameGiven ) //$NON-NLS-1$
119             .append( "description", this.description ).append( "deprecated", this.deprecated ).append( "type", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
120                                                                                                        this.type )
121             .append( "scope", this.scope ).append( "nameFromAttribute", this.nameFromAttribute ).toString(); //$NON-NLS-1$ //$NON-NLS-2$
122     }
123 
124     /**
125      * @see java.lang.Comparable#compareTo(Object)
126      */
127     public int compareTo( TagVariable object )
128     {
129         return new CompareToBuilder().append( this.deprecated, object.deprecated ).append( this.nameGiven,
130                                                                                            object.nameGiven )
131             .append( this.nameFromAttribute, object.nameFromAttribute ).toComparison();
132     }
133 
134     /**
135      * @see java.lang.Object#equals(Object)
136      */
137     @Override
138     public boolean equals( Object obj )
139     {
140         if( obj == null )
141         {
142             return false;
143         }
144 
145         if( obj == this )
146         {
147             return true;
148         }
149 
150         if( obj.getClass() != getClass() )
151         {
152             return false;
153         }
154 
155         TagVariable rhs = (TagVariable) obj;
156         return new EqualsBuilder().append( this.deprecated, rhs.deprecated ).append( this.nameGiven,
157                                                                                      rhs.nameGiven )
158             .append( this.nameFromAttribute, rhs.nameFromAttribute ).isEquals();
159       }
160 
161     /**
162      * @see java.lang.Object#hashCode()
163      */
164     @Override
165     public int hashCode() {
166         return new HashCodeBuilder().append( this.deprecated ).append( this.nameGiven )
167             .append( this.nameFromAttribute ).toHashCode();
168       }
169 
170 }