aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-25 18:26:31 +0000
committerMichael Williamson <mike@zwobble.org>2015-10-25 18:26:31 +0000
commit8b3e130f87a9b55ce1d7ae02747a0eeb97204391 (patch)
tree676b2026152b9ee7c0a85cb3e65b118e367e48d7 /src/main
parent5295624f7252662025532cc54ac17baebb0a3f65 (diff)
Remove lombok from StaticMethodCallNode
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/zwobble/couscous/ast/StaticMethodCallNode.java83
1 files changed, 77 insertions, 6 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/StaticMethodCallNode.java b/src/main/java/org/zwobble/couscous/ast/StaticMethodCallNode.java
index e0566cf..2b63948 100644
--- a/src/main/java/org/zwobble/couscous/ast/StaticMethodCallNode.java
+++ b/src/main/java/org/zwobble/couscous/ast/StaticMethodCallNode.java
@@ -6,9 +6,6 @@ import org.zwobble.couscous.ast.visitors.ExpressionNodeMapper;
import static java.util.Arrays.asList;
-import lombok.Value;
-
-@Value(staticConstructor="staticMethodCall")
public class StaticMethodCallNode implements ExpressionNode {
public static StaticMethodCallNode staticMethodCall(String className, String methodName, ExpressionNode... arguments) {
return staticMethodCall(className, methodName, asList(arguments));
@@ -18,9 +15,37 @@ public class StaticMethodCallNode implements ExpressionNode {
return staticMethodCall(TypeName.of(className), methodName, arguments);
}
- TypeName className;
- String methodName;
- List<ExpressionNode> arguments;
+ public static StaticMethodCallNode staticMethodCall(
+ TypeName className,
+ String methodName,
+ List<ExpressionNode> arguments) {
+ return new StaticMethodCallNode(className, methodName, arguments);
+ }
+
+ private final TypeName className;
+ private final String methodName;
+ private final List<ExpressionNode> arguments;
+
+ public StaticMethodCallNode(
+ TypeName className,
+ String methodName,
+ List<ExpressionNode> arguments) {
+ this.className = className;
+ this.methodName = methodName;
+ this.arguments = arguments;
+ }
+
+ public TypeName getClassName() {
+ return className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public List<ExpressionNode> getArguments() {
+ return arguments;
+ }
@Override
public <T> T accept(ExpressionNodeMapper<T> visitor) {
@@ -31,4 +56,50 @@ public class StaticMethodCallNode implements ExpressionNode {
public TypeName getType() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String toString() {
+ return "StaticMethodCallNode(className=" + className + ", methodName="
+ + methodName + ", arguments=" + arguments + ")";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((arguments == null) ? 0 : arguments.hashCode());
+ result = prime * result
+ + ((className == null) ? 0 : className.hashCode());
+ result = prime * result
+ + ((methodName == null) ? 0 : methodName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ StaticMethodCallNode other = (StaticMethodCallNode) obj;
+ if (arguments == null) {
+ if (other.arguments != null)
+ return false;
+ } else if (!arguments.equals(other.arguments))
+ return false;
+ if (className == null) {
+ if (other.className != null)
+ return false;
+ } else if (!className.equals(other.className))
+ return false;
+ if (methodName == null) {
+ if (other.methodName != null)
+ return false;
+ } else if (!methodName.equals(other.methodName))
+ return false;
+ return true;
+ }
}