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

com.netopyr.reduxfx.vscenegraph.impl.differ.patches.SetChildrenPatch Maven / Gradle / Ivy

package com.netopyr.reduxfx.vscenegraph.impl.differ.patches;

import com.netopyr.reduxfx.vscenegraph.VNode;
import io.vavr.collection.Array;
import io.vavr.collection.Vector;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Objects;

public class SetChildrenPatch extends Patch {

    private final String name;
    private final Array children;

    public SetChildrenPatch(Vector path, String name, Array children) {
        super(path);
        this.name = Objects.requireNonNull(name, "Name must not be null");
        this.children = Objects.requireNonNull(children, "Children must not be null");
    }

    public String getName() {
        return name;
    }

    public Array getChildren() {
        return children;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
                .append("name", name)
                .append("children", children)
                .toString();
    }
}