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

io.deephaven.plot.util.functions.HasClosure Maven / Gradle / Ivy

There is a newer version: 0.36.1
Show newest version
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.plot.util.functions;

import io.deephaven.base.verify.Require;
import groovy.lang.Closure;

/**
 * A serializable closure.
 */
public class HasClosure {

    private final Closure closure;

    /**
     * Creates a SerializableClosure instance with the {@code closure}.
     *
     * @param closure closure
     */
    public HasClosure(final Closure closure) {
        Require.neqNull(closure, "closure");
        this.closure = closure.dehydrate();
        this.closure.setResolveStrategy(Closure.DELEGATE_ONLY);
    }

    /**
     * Gets this SerializableClosure's closure.
     *
     * @return this SerializableClosure's closure
     */
    public Closure getClosure() {
        return closure;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy