aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/internal/html/HtmlElement.java
blob: e855f2643556c21823190d61954cb1228999d6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.zwobble.mammoth.internal.html;

import java.util.List;
import java.util.Map;

public class HtmlElement implements HtmlNode {
    private final List<String> tagNames;
    private final Map<String, String> attributes;
    private final List<HtmlNode> children;
    private final boolean collapsible;

    public HtmlElement(List<String> tagNames, Map<String, String> attributes, List<HtmlNode> children, boolean collapsible) {
        this.tagNames = tagNames;
        this.attributes = attributes;
        this.children = children;
        this.collapsible = collapsible;
    }

    public List<String> getTagNames() {
        return tagNames;
    }

    public String getTagName() {
        return tagNames.get(0);
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    public List<HtmlNode> getChildren() {
        return children;
    }

    public boolean isCollapsible() {
        return collapsible;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
    }

    @Override
    public <T> T accept(Mapper<T> visitor) {
        return visitor.visit(this);
    }
}