Class BuildUserMacro
- java.lang.Object
-
- org.jenkinsci.plugins.tokenmacro.TokenMacro
-
- org.jenkinsci.plugins.tokenmacro.impl.BuildUserMacro
-
- All Implemented Interfaces:
ExtensionPoint
@Extension public class BuildUserMacro extends TokenMacro
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
MACRO_NAME
-
Constructor Summary
Constructors Constructor Description BuildUserMacro()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsMacroName(String macroName)
Returns true if this object can evaluate the macro of the given name.String
evaluate(AbstractBuild<?,?> context, 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(Run<?,?> run, FilePath workspace, TaskListener listener, String macroName, Map<String,String> arguments, com.google.common.collect.ListMultimap<String,String> argumentMultimap)
List<String>
getAcceptedMacroNames()
-
Methods inherited from class org.jenkinsci.plugins.tokenmacro.TokenMacro
all, expand, expand, expand, expand, expandAll, expandAll, expandAll, expandAll, getAutoCompleteList, getPreviousRun, getWorkspace, hasNestedContent
-
-
-
-
Field Detail
-
MACRO_NAME
public static final String MACRO_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
acceptsMacroName
public boolean acceptsMacroName(String macroName)
Description copied from class:TokenMacro
Returns true if this object can evaluate the macro of the given name.- Specified by:
acceptsMacroName
in classTokenMacro
- Parameters:
macroName
- By convention we encourage all caps name.- Returns:
- true
... to claim the macro of the given name and have
TokenMacro.evaluate(AbstractBuild, TaskListener, String, Map, ListMultimap)
called.
-
getAcceptedMacroNames
public List<String> getAcceptedMacroNames()
- Overrides:
getAcceptedMacroNames
in classTokenMacro
-
evaluate
public String evaluate(AbstractBuild<?,?> context, TaskListener listener, String macroName, Map<String,String> arguments, com.google.common.collect.ListMultimap<String,String> argumentMultimap) throws MacroEvaluationException, IOException, InterruptedException
Description copied from class:TokenMacro
Evaluates the macro and produces the token. If the token is to produce a human readable text, it should do so by using the implicit locale associated with the calling thread — seeFunctions.getCurrentLocale()
.- Specified by:
evaluate
in classTokenMacro
- Parameters:
context
- 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 fromargumentMultimap
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 thanarguments
, but it's bit more tedious to use.- Returns:
- The result of the evaluation. Must not be null.
- Throws:
MacroEvaluationException
- If the evaluation failed, for example because of the parameter error, and that the error message should be presented.IOException
- Other fatalIOException
s 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 anInterruptedException
. Don't catch it, just propagate.
-
evaluate
public String evaluate(Run<?,?> run, FilePath workspace, TaskListener listener, String macroName, Map<String,String> arguments, com.google.common.collect.ListMultimap<String,String> argumentMultimap) throws MacroEvaluationException, IOException, InterruptedException
- Overrides:
evaluate
in classTokenMacro
- Throws:
MacroEvaluationException
IOException
InterruptedException
-
-