Class Snippetizer
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.cps.Snippetizer
-
- All Implemented Interfaces:
ExtensionPoint
,Action
,DescriptorByNameOwner
,ModelObject
,RootAction
- Direct Known Subclasses:
Snippetizer.LocalAction
@Extension public class Snippetizer extends Object implements RootAction, DescriptorByNameOwner
Takes aStep
as configured through the UI and tries to produce equivalent Groovy code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Snippetizer.LocalAction
May be added to various contexts to offer the Pipeline Groovy link where it is appropriate.static class
Snippetizer.PerJobAdder
static class
Snippetizer.QuasiDescriptor
Represents a step or other step-like objects that should appear inSnippetizer
’s main dropdown list and can generate some fragment of Pipeline script.-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_URL
static String
GENERATE_URL
-
Constructor Summary
Constructors Constructor Description Snippetizer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.kohsuke.stapler.HttpResponse
doGenerateSnippet(org.kohsuke.stapler.StaplerRequest req, String json)
String
getDisplayName()
Iterable<GlobalVariable>
getGlobalVariables()
String
getIconFileName()
Item
getItem(org.kohsuke.stapler.StaplerRequest req)
Collection<Snippetizer.QuasiDescriptor>
getQuasiDescriptors(boolean advanced)
List<SnippetizerLink>
getSnippetizerLinks()
Used to generate the list of links on the sidepanel.String
getUrlName()
static String
object2Groovy(Object o)
Publicly accessible version ofobject2Groovy(StringBuilder, Object, boolean)
that translates an object into the equivalent Pipeline Groovy string.static String
object2Groovy(Object o, boolean nestedExp)
Publicly accessible version ofobject2Groovy(StringBuilder, Object, boolean)
that translates an object into the equivalent Pipeline Groovy string.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
-
-
-
-
Field Detail
-
ACTION_URL
public static final String ACTION_URL
- See Also:
- Constant Field Values
-
GENERATE_URL
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String GENERATE_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
object2Groovy
public static String object2Groovy(Object o) throws UnsupportedOperationException
Publicly accessible version ofobject2Groovy(StringBuilder, Object, boolean)
that translates an object into the equivalent Pipeline Groovy string.- Parameters:
o
- The object to translate.- Returns:
- A string translation of the object.
- Throws:
UnsupportedOperationException
-
object2Groovy
public static String object2Groovy(Object o, boolean nestedExp) throws UnsupportedOperationException
Publicly accessible version ofobject2Groovy(StringBuilder, Object, boolean)
that translates an object into the equivalent Pipeline Groovy string.- Parameters:
o
- The object to translate.nestedExp
- true if this object is written as a nested expression (in which case we always produce parentheses for readability)- Returns:
- A string translation of the object.
- Throws:
UnsupportedOperationException
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getQuasiDescriptors
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Collection<Snippetizer.QuasiDescriptor> getQuasiDescriptors(boolean advanced)
-
getGlobalVariables
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public Iterable<GlobalVariable> getGlobalVariables()
-
doGenerateSnippet
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public org.kohsuke.stapler.HttpResponse doGenerateSnippet(org.kohsuke.stapler.StaplerRequest req, @QueryParameter String json) throws Exception
- Throws:
Exception
-
getItem
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @CheckForNull public Item getItem(org.kohsuke.stapler.StaplerRequest req)
-
getSnippetizerLinks
@NonNull public List<SnippetizerLink> getSnippetizerLinks()
Used to generate the list of links on the sidepanel.
-
-