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

com.cloudbees.groovy.cps.impl.CaseEnv Maven / Gradle / Ivy

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

import com.cloudbees.groovy.cps.Continuation;
import com.cloudbees.groovy.cps.Env;

/**
 * @author Kohsuke Kawaguchi
 */
public class CaseEnv extends ProxyEnv {
    final String label;
    final Continuation break_;

    public CaseEnv(Env parent, String label, Continuation break_) {
        super(parent);
        this.label = label;
        this.break_ = break_;
    }

    @Override
    public Continuation getBreakAddress(String label) {
        if (labelMatch(label))  return break_;
        else                    return super.getBreakAddress(label);
    }

    private boolean labelMatch(String given) {
        return given==null || given.equals(label);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy