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

hudson.tasks.BuildStepDescriptor Maven / Gradle / Ivy

package hudson.tasks;

import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.AbstractProject;

import java.util.List;
import java.util.ArrayList;

/**
 * {@link Descriptor} for {@link Builder} and {@link Publisher}.
 *
 * 

* For compatibility reasons, plugins developed before 1.150 may not extend from this descriptor type. * * @author Kohsuke Kawaguchi * @since 1.150 */ public abstract class BuildStepDescriptor> extends Descriptor { protected BuildStepDescriptor(Class clazz) { super(clazz); } /** * Returns true if this task is applicable to the given project. * * @return * true to allow user to configure this post-promotion task for the given project. */ public abstract boolean isApplicable(Class jobType); /** * Fiters a descriptor for {@link BuildStep}s by using {@link BuildStepDescriptor#isApplicable(Class)}. */ public static > List> filter(List> base, Class type) { List> r = new ArrayList>(base.size()); for (Descriptor d : base) { if (d instanceof BuildStepDescriptor) { BuildStepDescriptor bd = (BuildStepDescriptor) d; if(bd.isApplicable(type)) r.add(bd); } else { // old plugins built before 1.150 may not implement BuildStepDescriptor r.add(d); } } return r; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy