From 0a5d0177a34713c968f16f31478bea88767a9f79 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 25 Oct 2015 18:01:07 +0000 Subject: Remove lombok from ConstructorCallNode --- .../zwobble/couscous/ast/ConstructorCallNode.java | 67 ++++++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/zwobble/couscous/ast/ConstructorCallNode.java b/src/main/java/org/zwobble/couscous/ast/ConstructorCallNode.java index 2aecc6c..6a4655a 100644 --- a/src/main/java/org/zwobble/couscous/ast/ConstructorCallNode.java +++ b/src/main/java/org/zwobble/couscous/ast/ConstructorCallNode.java @@ -4,15 +4,72 @@ import java.util.List; import org.zwobble.couscous.ast.visitors.ExpressionNodeMapper; -import lombok.Value; - -@Value(staticConstructor="constructorCall") public class ConstructorCallNode implements ExpressionNode { - TypeName type; - List arguments; + public static ConstructorCallNode constructorCall( + TypeName type, + List arguments) { + return new ConstructorCallNode(type, arguments); + } + + private final TypeName type; + private final List arguments; + + public ConstructorCallNode( + TypeName type, + List arguments) { + this.type = type; + this.arguments = arguments; + } + + @Override + public TypeName getType() { + return type; + } + + public List getArguments() { + return arguments; + } @Override public T accept(ExpressionNodeMapper visitor) { return visitor.visit(this); } + + @Override + public String toString() { + return "ConstructorCallNode(type=" + type + ", arguments=" + arguments + + ")"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((arguments == null) ? 0 : arguments.hashCode()); + result = prime * result + ((type == null) ? 0 : type.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; + ConstructorCallNode other = (ConstructorCallNode) obj; + if (arguments == null) { + if (other.arguments != null) + return false; + } else if (!arguments.equals(other.arguments)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } } -- cgit v1.2.3