aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-25 17:44:32 +0000
committerMichael Williamson <mike@zwobble.org>2015-10-25 17:44:32 +0000
commit0a4c805808f6470943773bc1fd5333662f9f5c2b (patch)
tree2b5678e667dd810d539bee61d222ac2d18e7a432 /src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java
parenta435bc428f92f0e5c762a0a578e230cd7756ad37 (diff)
Remove lombok from VariableDeclaration
Diffstat (limited to 'src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java')
-rw-r--r--src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java74
1 files changed, 68 insertions, 6 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java b/src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java
index 84c0d43..713f3a6 100644
--- a/src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java
+++ b/src/main/java/org/zwobble/couscous/ast/VariableDeclaration.java
@@ -1,10 +1,72 @@
package org.zwobble.couscous.ast;
-import lombok.Value;
-
-@Value(staticConstructor="var")
public class VariableDeclaration {
- String id;
- String name;
- TypeName type;
+ public static VariableDeclaration var(String id, String name, TypeName type) {
+ return new VariableDeclaration(id, name, type);
+ }
+
+ private final String id;
+ private final String name;
+ private final TypeName type;
+
+ private VariableDeclaration(String id, String name, TypeName type) {
+ this.id = id;
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public TypeName getType() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return "VariableDeclaration(id=" + id + ", name=" + name + ", type="
+ + type + ")";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.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;
+ VariableDeclaration other = (VariableDeclaration) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
}