public class RunSelectorContext extends Object implements Cloneable
You can manage plugin specific information using
addExtension(Object)
and getExtension(Class)
.
Constructor and Description |
---|
RunSelectorContext(jenkins.model.Jenkins jenkins,
hudson.model.Run<?,?> build,
hudson.model.TaskListener listener)
Creates a new
RunSelectorContext with NoRunFilter . |
RunSelectorContext(jenkins.model.Jenkins jenkins,
hudson.model.Run<?,?> build,
hudson.model.TaskListener listener,
RunFilter runFilter)
Creates a new
RunSelectorContext . |
Modifier and Type | Method and Description |
---|---|
void |
addExtension(Object extension)
Add an object to hold plugin specific information.
|
RunSelectorContext |
clone() |
hudson.model.Run<?,?> |
getBuild() |
PrintStream |
getConsole()
Shortcut for
getListener().getLogger() |
hudson.EnvVars |
getEnvVars() |
<T> T |
getExtension(Class<T> clazz)
Extract an extension object of the specified class.
|
List<Object> |
getExtensionList() |
jenkins.model.Jenkins |
getJenkins() |
hudson.model.Run<?,?> |
getLastMatchBuild()
The build picked at the last time (but not matched with the filter).
|
hudson.model.TaskListener |
getListener() |
RunFilter |
getRunFilter() |
boolean |
isVerbose() |
void |
logDebug(String message)
Outputs a log message if
isVerbose() is true |
void |
logDebug(String pattern,
Object... arguments)
|
void |
logException(String string,
Throwable t)
Outputs a log message with an exception
|
void |
logInfo(String message)
Outputs a log message
|
void |
logInfo(String pattern,
Object... arguments)
Outputs a log message in
MessageFormat formats. |
boolean |
removeExtension(Object extension) |
boolean |
replaceExtension(Object extension)
Removes extensions with the same class type before adding.
|
void |
setLastMatchBuild(hudson.model.Run<?,?> lastMatchBuild) |
void |
setRunFilter(RunFilter runFilter) |
void |
setVerbose(boolean verbose) |
public RunSelectorContext(@Nonnull jenkins.model.Jenkins jenkins, @Nonnull hudson.model.Run<?,?> build, @Nonnull hudson.model.TaskListener listener) throws IOException, InterruptedException
RunSelectorContext
with NoRunFilter
.jenkins
- the Jenkins instancebuild
- the build running runselectorlistener
- listener for the build running runselectorIOException
InterruptedException
public RunSelectorContext(@Nonnull jenkins.model.Jenkins jenkins, @Nonnull hudson.model.Run<?,?> build, @Nonnull hudson.model.TaskListener listener, @Nonnull RunFilter runFilter) throws IOException, InterruptedException
RunSelectorContext
.jenkins
- the Jenkins instancebuild
- the build running runselectorlistener
- listener for the build running runselectorIOException
InterruptedException
@Nonnull public jenkins.model.Jenkins getJenkins()
@Nonnull public hudson.model.Run<?,?> getBuild()
@Nonnull public hudson.model.TaskListener getListener()
@Nonnull public hudson.EnvVars getEnvVars()
@Nonnull public PrintStream getConsole()
getListener().getLogger()
public void setVerbose(boolean verbose)
verbose
- whether output verbose (for diagnostics) logspublic boolean isVerbose()
public void setRunFilter(@Nonnull RunFilter runFilter)
runFilter
- the filter for buildspublic void setLastMatchBuild(hudson.model.Run<?,?> lastMatchBuild)
lastMatchBuild
- build picked at the last time@CheckForNull public hudson.model.Run<?,?> getLastMatchBuild()
RunSelector
s should continue the enumeration from this.@Nonnull public List<Object> getExtensionList()
public void addExtension(@Nonnull Object extension)
extension
- extension objectpublic boolean removeExtension(@Nonnull Object extension)
extension
- extension object to removepublic boolean replaceExtension(@Nonnull Object extension)
extension
- extension object to replace with@CheckForNull public <T> T getExtension(@Nonnull Class<T> clazz)
T
- specified with clazz
clazz
- class of the extension to extractpublic void logInfo(@Nonnull String message)
message
- message to logpublic void logInfo(@Nonnull String pattern, Object... arguments)
MessageFormat
formats.pattern
- pattern for MessageFormat
arguments
- values to formatpublic void logDebug(@Nonnull String message)
isVerbose()
is true
message
- message to logpublic void logDebug(@Nonnull String pattern, Object... arguments)
pattern
- pattern for MessageFormat
arguments
- values to formatpublic void logException(@Nonnull String string, @Nonnull Throwable t)
string
- message to logt
- exception to logpublic RunSelectorContext clone()
Copyright © 2016–2020. All rights reserved.