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

com.cloudbees.groovy.cps.Envs Maven / Gradle / Ivy

There is a newer version: 1.31
Show newest version
package com.cloudbees.groovy.cps;

import com.cloudbees.groovy.cps.impl.FunctionCallEnv;
import com.cloudbees.groovy.cps.sandbox.Invoker;

/**
 * Utility factory methods for {@link Env}.
 *
 * @author Kohsuke Kawaguchi
 */
public class Envs {
    /**
     * The most plain vanilla environment suitable for outer-most use.
     *
     * Analogous to how {@link Runnable#run()} gets invoked "out of nowhere" when a new {@link Thread} starts in
     * regular Java program.
     */
    public static Env empty() {
        return new FunctionCallEnv(null,Continuation.HALT,null,null);
    }

    /**
     * Works like {@link #empty()} except it allows a custom {@link Invoker}.
     */
    public static Env empty(Invoker inv) {
        FunctionCallEnv e = new FunctionCallEnv(null, Continuation.HALT, null, null);
        e.setInvoker(inv);
        return e;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy