All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.protostuff.generator.html.json.index.JsonTreeNode Maven / Gradle / Ivy

There is a newer version: 3.1.40
Show newest version
package io.protostuff.generator.html.json.index;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Kostiantyn Shchepanovskyi
 */
public class JsonTreeNode {
    private final String label;
    private NodeData data;
    private final List children;

    private JsonTreeNode(Builder builder) {
        label = builder.label;
        data = builder.data;
        children = builder.children;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getLabel() {
        return label;
    }

    public List getChildren() {
        return children;
    }

    public NodeData getData() {
        return data;
    }

    public static final class Builder {
        private String label;
        private NodeData data;
        private List children;

        private Builder() {
        }

        public Builder label(String val) {
            label = val;
            return this;
        }

        public Builder data(NodeData val) {
            data = val;
            return this;
        }

        public Builder children(List val) {
            children = val;
            return this;
        }

        public Builder addChild(JsonTreeNode val) {
            if (children == null) {
                children = new ArrayList<>();
            }
            children.add(val);
            return this;
        }

        public JsonTreeNode build() {
            return new JsonTreeNode(this);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy