aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java')
-rw-r--r--src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java60
1 files changed, 55 insertions, 5 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java b/src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java
index 49a45d3..58b05f2 100644
--- a/src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java
+++ b/src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java
@@ -1,9 +1,59 @@
package org.zwobble.couscous.ast;
-import lombok.Value;
-
-@Value(staticConstructor="field")
public class FieldDeclarationNode {
- String name;
- TypeName type;
+ public static FieldDeclarationNode field(String name, TypeName type) {
+ return new FieldDeclarationNode(name, type);
+ }
+
+ private final String name;
+ private final TypeName type;
+
+ private FieldDeclarationNode(String name, TypeName type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public TypeName getType() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return "FieldDeclarationNode(name=" + name + ", type=" + type + ")";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ 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;
+ FieldDeclarationNode other = (FieldDeclarationNode) obj;
+ 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;
+ }
}