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