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

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

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

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

import java.util.Objects;

public class SetSingleChildPatch extends Patch {

    private final String name;
    private final Option child;

    public SetSingleChildPatch(Vector path, String name, Option child) {
        super(path);
        this.name = Objects.requireNonNull(name, "Name must not be null");
        this.child = Objects.requireNonNull(child, "Child must not be null");
    }

    public String getName() {
        return name;
    }

    public Option getChild() {
        return child;
    }

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