diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-10-25 20:59:42 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-10-25 20:59:42 +0000 |
| commit | a7467ecfcda9bf6e2f67c74fdddca290d27d9da6 (patch) | |
| tree | f66114d21a0b2ee6832b1d473e3f68c8a0ec06b5 /src/main/java/org/zwobble/mammoth/xml/XmlElement.java | |
| parent | 84c1a42a0cdb36fbf5c6b2653a872c230bfe16f3 (diff) | |
Remove lombok
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/xml/XmlElement.java')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/xml/XmlElement.java | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/src/main/java/org/zwobble/mammoth/xml/XmlElement.java b/src/main/java/org/zwobble/mammoth/xml/XmlElement.java index b5e8f1b..659be2d 100644 --- a/src/main/java/org/zwobble/mammoth/xml/XmlElement.java +++ b/src/main/java/org/zwobble/mammoth/xml/XmlElement.java @@ -6,14 +6,6 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.ToString; - -@RequiredArgsConstructor -@EqualsAndHashCode -@ToString public class XmlElement implements XmlNode { public XmlElement(String name) { this(name, ImmutableMap.of()); @@ -23,11 +15,20 @@ public class XmlElement implements XmlNode { this(name, attributes, ImmutableList.of()); } - @Getter private final String name; private final Map<String, String> attributes; private final List<XmlNode> children; + public XmlElement(String name, Map<String, String> attributes, List<XmlNode> children) { + this.name = name; + this.attributes = attributes; + this.children = children; + } + + public String getName() { + return name; + } + @Override public <T> T accept(XmlNodeVisitor<T> visitor) { return visitor.visit(this); @@ -36,4 +37,49 @@ public class XmlElement implements XmlNode { public Iterable<XmlNode> children() { return children; } + + @Override + public String toString() { + return "XmlElement(name=" + name + ", attributes=" + attributes + + ", children=" + children + ")"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((attributes == null) ? 0 : attributes.hashCode()); + result = prime * result + + ((children == null) ? 0 : children.hashCode()); + result = prime * result + ((name == null) ? 0 : name.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; + XmlElement other = (XmlElement) obj; + if (attributes == null) { + if (other.attributes != null) + return false; + } else if (!attributes.equals(other.attributes)) + return false; + if (children == null) { + if (other.children != null) + return false; + } else if (!children.equals(other.children)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } } |
