diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-10-25 18:12:18 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-10-25 18:12:18 +0000 |
| commit | 8bca475f4f51c7ab1424c6315dee2278514cbe5e (patch) | |
| tree | 83e1481086a28c2d45a3d8ce8928ba23e89de716 /src/main/java | |
| parent | c7b7150782766a1ef2929e8a61b7f78f08c92b04 (diff) | |
Remove lombok from FieldDeclarationNode
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/zwobble/couscous/ast/FieldDeclarationNode.java | 60 |
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; + } } |
