public abstract class StepDescriptor extends hudson.model.Descriptor<Step>
Constructor and Description |
---|
StepDescriptor() |
Modifier and Type | Method and Description |
---|---|
static hudson.ExtensionList<StepDescriptor> |
all() |
static Iterable<StepDescriptor> |
allMeta()
Convenience method to iterate all meta step descriptors.
|
static StepDescriptor |
byFunctionName(String name)
Obtains a
StepDescriptor by its function name, or null if not found. |
void |
checkContextAvailability(StepContext c)
Makes sure that the given
StepContext has all the context parameters this descriptor wants to see,
and if not, throw MissingContextVariableException indicating which variable is missing. |
Map<String,Object> |
defineArguments(Step step)
Deprecated.
|
abstract String |
getFunctionName()
Return a short string that is a valid identifier for programming languages.
|
Class<?> |
getMetaStepArgumentType()
For a meta step, return the type that this meta step handles.
|
Set<? extends Class<?>> |
getProvidedContext()
Returns the context
Step adds/sets/modifies when executing a body. |
abstract Set<? extends Class<?>> |
getRequiredContext()
Returns the context
Step needs to access. |
boolean |
isAdvanced()
For UI presentation purposes, allows a plugin to mark a step as deprecated or advanced.
|
boolean |
isMetaStep()
Some steps, such as
CoreStep or GenericSCMStep can take
arbitrary Describable s of a certain type and execute it as a step. |
static List<StepDescriptor> |
metaStepsOf(String symbol)
Given a symbol, attempt to find all the meta-steps that can consume this symbol.
|
Step |
newInstance(Map<String,Object> arguments)
Used when a
Step is instantiated programmatically. |
boolean |
takesImplicitBlockArgument()
Return true if this step can accept an implicit block argument.
|
org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable |
uninstantiate(Step step)
Determine which arguments went into the configuration of a step configured through a form submission.
|
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, findByDescribableClassName, findById, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
public abstract Set<? extends Class<?>> getRequiredContext()
Step
needs to access.
This allows the system to statically infer which steps are applicable in which context
(say in freestyle or in workflow).StepContext.get(Class)
public Set<? extends Class<?>> getProvidedContext()
Step
adds/sets/modifies when executing a body.
This is used to diagnose a "missing context" problem by suggesting what wrapper steps were likely missing. Steps that does not take a body block must return the empty set as it has nothing to contribute to the context.
This set and getRequiredContext()
can be compared to determine context variables that are newly
added (as opposed to get merely decorated.)
MissingContextVariableException
public abstract String getFunctionName()
[a-z][A-Za-z0-9_]*
.
Step will be referenced by this name when used in a programming language.public boolean takesImplicitBlockArgument()
StepContext.hasBody()
will be false.)StepContext.newBodyInvoker()
public boolean isAdvanced()
public boolean isMetaStep()
CoreStep
or GenericSCMStep
can take
arbitrary Describable
s of a certain type and execute it as a step.
Such a step should return true from this method so that Describable
s that
it supports can be directly written as a step as a short-hand.
Meta-step works as an invisible adapter that creates an illusion that Describable
s are
steps.
For example, in Jenkins Pipeline, if there is a meta step that can handle a Describable
,
and it has a symbol, it allows the following short-hand:
public class Xyz extends Foo { @DataBoundConstructor public Xyz(String value) { ... } @Extension @Symbol("xyz") public static class DescriptorImpl extends FooDescriptor { ... } } public class MetaStepForFoo extends AbstractStepImpl { @DataBoundConstructor public MetaStepForFoo(Foo delegate) { ... } ... @Extension public static class DescriptorImpl extends AbstractStepDescriptorImpl { @Override public String getFunctionName() { return "metaStepForFoo"; } @Override public boolean isMetaStep() { return true; } } } // this is the short-hand that users will use xyz('hello') // but this is how it actually gets executed metaStepForFoo(xyz('hello'))
Meta-step must have a DataBoundConstructor
whose first argument represents a
Describable
that it handles.
@Nullable public final Class<?> getMetaStepArgumentType()
public Step newInstance(Map<String,Object> arguments) throws Exception
Step
is instantiated programmatically.
The default implementation just uses DescribableModel.instantiate(java.util.Map<java.lang.String, ?>)
.arguments
- Named arguments and values, à la Ant task or Maven mojos.
Generally should follow the semantics of DescribableModel.instantiate(java.util.Map<java.lang.String, ?>)
.Descriptor.clazz
Exception
@Deprecated public Map<String,Object> defineArguments(Step step) throws UnsupportedOperationException
uninstantiate(Step)
step
- a fully-configured step (assignable to Descriptor.clazz
)newInstance(java.util.Map<java.lang.String, java.lang.Object>)
to create a similar step instanceUnsupportedOperationException
- if this descriptor lacks the ability to do such a calculationpublic org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable uninstantiate(Step step) throws UnsupportedOperationException
step
- a fully-configured step (assignable to Descriptor.clazz
)newInstance(java.util.Map<java.lang.String, java.lang.Object>)
to create a similar step instanceUnsupportedOperationException
- if this descriptor lacks the ability to do such a calculationpublic final void checkContextAvailability(StepContext c) throws MissingContextVariableException, IOException, InterruptedException
StepContext
has all the context parameters this descriptor wants to see,
and if not, throw MissingContextVariableException
indicating which variable is missing.public static hudson.ExtensionList<StepDescriptor> all()
public static Iterable<StepDescriptor> allMeta()
@Nullable public static StepDescriptor byFunctionName(String name)
StepDescriptor
by its function name, or null if not found.@Nonnull public static List<StepDescriptor> metaStepsOf(String symbol)
Copyright © 2016–2017. All rights reserved.