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 * Contains information about an EL function.
32 * @author Fabrizio Giustina
33 * @version $Revision $ ($Author $)
34 */
35 public class ELFunction extends TldItem
36 {
37
38 private String functionClass;
39
40 private String functionSignature;
41
42 private String parameters;
43
44 /**
45 * Returns the functionClass.
46 * @return the functionClass
47 */
48 public String getFunctionClass()
49 {
50 return functionClass;
51 }
52
53 /**
54 * Sets the functionClass.
55 * @param functionClass the functionClass to set
56 */
57 public void setFunctionClass(String functionClass)
58 {
59 this.functionClass = functionClass;
60 }
61
62 /**
63 * Returns the functionSignature.
64 * @return the functionSignature
65 */
66 public String getFunctionSignature()
67 {
68 return functionSignature;
69 }
70
71 /**
72 * Sets the functionSignature.
73 * @param functionSignature the functionSignature to set
74 */
75 public void setFunctionSignature(String functionSignature)
76 {
77 this.functionSignature = functionSignature;
78 }
79
80 /**
81 * Returns the parameters.
82 * @return the parameters
83 */
84 public String getParameters()
85 {
86 return parameters;
87 }
88
89 /**
90 * Sets the parameters.
91 * @param parameters the parameters to set
92 */
93 public void setParameters(String parameters)
94 {
95 this.parameters = parameters;
96 }
97
98 /**
99 * @see java.lang.Comparable#compareTo(Object)
100 */
101 @Override
102 public int compareTo(TldItem object)
103 {
104 int ret = super.compareTo(object);
105 if (ret != 0) {
106 return ret;
107 }
108
109 ELFunction rhs = (ELFunction) object;
110 return new CompareToBuilder()
111 .append(this.functionClass, rhs.functionClass)
112 .append(this.functionSignature, rhs.functionSignature)
113 .append(this.parameters, rhs.parameters)
114 .toComparison();
115 }
116
117 /**
118 * @see java.lang.Object#equals(Object)
119 */
120 @Override
121 public boolean equals(Object obj)
122 {
123 if(obj == null || !super.equals(obj))
124 {
125 return false;
126 }
127
128 ELFunction rhs = (ELFunction) obj;
129 return new EqualsBuilder()
130 .append(this.functionClass, rhs.functionClass)
131 .append(this.functionSignature, rhs.functionSignature)
132 .append(this.parameters, rhs.parameters)
133 .isEquals();
134 }
135
136 /**
137 * @see java.lang.Object#hashCode()
138 */
139 @Override
140 public int hashCode() {
141 return new HashCodeBuilder()
142 .appendSuper(super.hashCode())
143 .append(this.functionClass)
144 .append(this.functionSignature)
145 .append(this.parameters)
146 .toHashCode();
147 }
148
149 }