Package jenkins.model.lazy
Class LazyBuildMixIn<JobT extends Job<JobT,RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT,RunT>,RunT extends Run<JobT,RunT> & LazyBuildMixIn.LazyLoadingRun<JobT,RunT>>
- java.lang.Object
-
- jenkins.model.lazy.LazyBuildMixIn<JobT,RunT>
-
public abstract class LazyBuildMixIn<JobT extends Job<JobT,RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT,RunT>,RunT extends Run<JobT,RunT> & LazyBuildMixIn.LazyLoadingRun<JobT,RunT>> extends Object
Makes it easier to use a lazyRunMap
from aJob
implementation. Provides method implementations for some abstractJob
methods, as well as some methods which are not abstract but which you should override.Should be kept in a
transient
field in the job.- Since:
- 1.556
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LazyBuildMixIn.ItemListenerImpl
static interface
LazyBuildMixIn.LazyLoadingJob<JobT extends Job<JobT,RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT,RunT>,RunT extends Run<JobT,RunT> & LazyBuildMixIn.LazyLoadingRun<JobT,RunT>>
Marker for aJob
which uses this mixin.static interface
LazyBuildMixIn.LazyLoadingRun<JobT extends Job<JobT,RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT,RunT>,RunT extends Run<JobT,RunT> & LazyBuildMixIn.LazyLoadingRun<JobT,RunT>>
Marker for aRun
which uses this mixin.static class
LazyBuildMixIn.RunMixIn<JobT extends Job<JobT,RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT,RunT>,RunT extends Run<JobT,RunT> & LazyBuildMixIn.LazyLoadingRun<JobT,RunT>>
Accompanying helper for the run type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LazyBuildMixIn()
Initializes this mixin.
-
Method Summary
-
-
-
Constructor Detail
-
LazyBuildMixIn
protected LazyBuildMixIn()
Initializes this mixin. Call this from a constructor andAbstractItem.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
to make sure it is always initialized.
-
-
Method Detail
-
asJob
protected abstract JobT asJob()
-
getRunMap
@NonNull public final RunMap<RunT> getRunMap()
Gets the raw model. Normally should not be called as such. Note that the initial value is replaced duringonCreatedFromScratch()
oronLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
.
-
_getRuns
public final RunMap<RunT> _getRuns()
Same asgetRunMap()
but suitable forJob._getRuns()
.
-
onCreatedFromScratch
public final void onCreatedFromScratch()
Something to be called fromJob.onCreatedFromScratch()
.
-
onLoad
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException
Something to be called fromJob.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
.- Throws:
IOException
-
getBuildClass
protected abstract Class<RunT> getBuildClass()
Type token for the build type. The build class must have two constructors: one taking the project type (P
); and one takingP
, thenFile
.
-
loadBuild
public RunT loadBuild(File dir) throws IOException
Loads an existing build record from disk. The default implementation just calls the (Job
,File
) constructor ofgetBuildClass()
, which will callRun(Job, File)
.- Throws:
IOException
-
newBuild
public final RunT newBuild() throws IOException
Creates a new build of this project for immediate execution. Calls the (Job
) constructor ofgetBuildClass()
, which will callRun(Job)
. Suitable forSubTask.createExecutable()
.- Throws:
IOException
-
removeRun
public final void removeRun(RunT run)
Suitable forJob.removeRun(RunT)
.
-
getBuild
public final RunT getBuild(String id)
Suitable forJob.getBuild(java.lang.String)
.
-
getBuildByNumber
public final RunT getBuildByNumber(int n)
Suitable forJob.getBuildByNumber(int)
.
-
getFirstBuild
public final RunT getFirstBuild()
Suitable forJob.getFirstBuild()
.
-
getLastBuild
@CheckForNull public final RunT getLastBuild()
Suitable forJob.getLastBuild()
.
-
getNearestBuild
public final RunT getNearestBuild(int n)
Suitable forJob.getNearestBuild(int)
.
-
getNearestOldBuild
public final RunT getNearestOldBuild(int n)
Suitable forJob.getNearestOldBuild(int)
.
-
createHistoryWidget
public final HistoryWidget createHistoryWidget()
Suitable forJob.createHistoryWidget()
.
-
-