@Extension public class BuildNumberMacro extends TokenMacro
| Modifier and Type | Field and Description |
|---|---|
static String |
MACRO_NAME |
| Constructor and Description |
|---|
BuildNumberMacro() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptsMacroName(String macroName)
Returns true if this object can evaluate the macro of the given name.
|
String |
evaluate(hudson.model.AbstractBuild<?,?> context,
hudson.model.TaskListener listener,
String macroName,
Map<String,String> arguments,
com.google.common.collect.ListMultimap<String,String> argumentMultimap)
Evaluates the macro and produces the token.
|
String |
evaluate(hudson.model.Run<?,?> run,
hudson.FilePath workspace,
hudson.model.TaskListener listener,
String macroName,
Map<String,String> arguments,
com.google.common.collect.ListMultimap<String,String> argumentMultimap) |
List<String> |
getAcceptedMacroNames() |
all, expand, expand, expand, expand, expandAll, expandAll, expandAll, expandAll, getAutoCompleteList, getPreviousRun, getWorkspace, hasNestedContentpublic static final String MACRO_NAME
public boolean acceptsMacroName(String macroName)
TokenMacroacceptsMacroName in class TokenMacromacroName - By convention we encourage all caps name.TokenMacro.evaluate(AbstractBuild, TaskListener, String, Map, ListMultimap) called.public List<String> getAcceptedMacroNames()
getAcceptedMacroNames in class TokenMacropublic String evaluate(hudson.model.AbstractBuild<?,?> context, hudson.model.TaskListener listener, String macroName, Map<String,String> arguments, com.google.common.collect.ListMultimap<String,String> argumentMultimap) throws MacroEvaluationException, IOException, InterruptedException
TokenMacro
If the token is to produce a human readable text, it should do so by using the implicit locale associated
with the calling thread — see Functions.getCurrentLocale().
evaluate in class TokenMacrocontext - The build object for which this macro is evaluated.listener - If the progress/status needs to be reported to the build console output, this object can be used.macroName - The macro name that you acceptedarguments - Arguments as a map. If multiple values are specified for one key, this will only retain the last one.
This is passed in separately from argumentMultimap becauseargumentMultimap - The same arguments, but in a multi-map. If multiple values are specified for one key, all of them
are retained here in the order of appearance. For those macros that support multiple values for the same key
this is more accurate than arguments, but it's bit more tedious to use.MacroEvaluationException - If the evaluation failed, for example because of the parameter error, and that the error message
should be presented.IOException - Other fatal IOExceptions that should leave the stack trace in the console.InterruptedException - If the evaluation involves some remoting operation, user might cancel the build, which results
in an InterruptedException. Don't catch it, just propagate.public String evaluate(hudson.model.Run<?,?> run, hudson.FilePath workspace, hudson.model.TaskListener listener, String macroName, Map<String,String> arguments, com.google.common.collect.ListMultimap<String,String> argumentMultimap) throws MacroEvaluationException, IOException, InterruptedException
evaluate in class TokenMacroMacroEvaluationExceptionIOExceptionInterruptedExceptionCopyright © 2016. All rights reserved.