Package jenkins.scm.api.trait
Class SCMNavigatorContext<C extends SCMNavigatorContext<C,R>,R extends SCMNavigatorRequest>
java.lang.Object
jenkins.scm.api.trait.SCMNavigatorContext<C,R>
- Type Parameters:
C
- the type ofSCMNavigatorContext
R
- the type ofSCMNavigatorRequest
produced by this context.
public abstract class SCMNavigatorContext<C extends SCMNavigatorContext<C,R>,R extends SCMNavigatorRequest>
extends Object
Represents the context within which a
SCMNavigator
is processing requests. In general this is used as a
builder for SCMNavigatorRequest
instances through
newRequest(SCMNavigator, SCMSourceObserver)
but there are some cases (such as
SCMSourceEvent
processing) where only the context is required and as such this
type will be instantiated to obtain the context but no SCMNavigatorRequest
will be created.
Conventions:
- The context is not designed to be shared by multiple threads.
- All methods should be either
final
orabstract
unless there is a documented reason for allowing overrides - All "setter" methods will return
SCMNavigatorContext
and be called "withXxx" - All "getter" methods will be called "xxx()". Callers should not assume that the returned value is resistant
from concurrent changes. Implementations should ensure that the returned value is immutable by the caller.
In other words, it is intentional for implementations to reduce intermediate allocations by
return Collections.unmodifiableList(theList);
rather than the concurrency safereturn Collections.unmodifiableList(new ArrayList<>(theList));
- Since:
- 2.2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal List<SCMSourceDecorator<?,
?>> Returns the (possibly empty) list ofSCMSourceDecorator
instances to apply to discovered projects.final List<SCMSourceFilter>
filters()
Returns the (possibly empty) list ofSCMNavigatorRequest
dependent filters.abstract R
newRequest
(SCMNavigator navigator, SCMSourceObserver observer) Creates a newSCMNavigatorRequest
.final List<SCMSourcePrefilter>
Returns the (possibly empty) list ofSCMNavigatorRequest
independent pre-filters.final List<SCMSourceTrait>
traits()
Returns the (possibly empty) list ofSCMSourceTrait
instances to apply to discovered projects.final C
withDecorator
(SCMSourceDecorator<?, ?> decorator) Adds the suppliedSCMSourceDecorator
.final C
withDecorators
(Collection<? extends SCMSourceDecorator<?, ?>> decorators) Adds the suppliedSCMSourceDecorator
instances.final C
withDecorators
(SCMSourceDecorator<?, ?>... decorators) Adds the suppliedSCMSourceDecorator
instances.final C
withFilter
(SCMSourceFilter filter) Adds the suppliedSCMSourceFilter
.final C
withPrefilter
(SCMSourcePrefilter prefilter) Adds the suppliedSCMSourcePrefilter
.final C
withTrait
(SCMNavigatorTrait trait) Applies the suppliedSCMNavigatorTrait
.final C
withTrait
(SCMSourceTrait trait) Adds the suppliedSCMSourceTrait
.final C
withTraits
(Collection<? extends SCMTrait<?>> traits) Adds / applies the suppliedSCMTrait
.final C
withTraits
(SCMTrait<? extends SCMTrait<?>>... traits) Adds / applies the suppliedSCMTrait
.
-
Constructor Details
-
SCMNavigatorContext
public SCMNavigatorContext()Constructor.
-
-
Method Details
-
decorators
Returns the (possibly empty) list ofSCMSourceDecorator
instances to apply to discovered projects.- Returns:
- the (possibly empty) list of
SCMSourceDecorator
instances to apply to discovered projects.
-
filters
Returns the (possibly empty) list ofSCMNavigatorRequest
dependent filters.- Returns:
- the (possibly empty) list of
SCMNavigatorRequest
dependent filters.
-
prefilters
Returns the (possibly empty) list ofSCMNavigatorRequest
independent pre-filters.- Returns:
- the (possibly empty) list of
SCMNavigatorRequest
independent pre-filters.
-
traits
Returns the (possibly empty) list ofSCMSourceTrait
instances to apply to discovered projects.- Returns:
- the (possibly empty) list of
SCMSourceTrait
instances to apply to discovered projects.
-
withFilter
Adds the suppliedSCMSourceFilter
.- Parameters:
filter
- the additionalSCMSourceFilter
.- Returns:
this
for method chaining.
-
withPrefilter
Adds the suppliedSCMSourcePrefilter
.- Parameters:
prefilter
- the additionalSCMSourcePrefilter
.- Returns:
this
for method chaining.
-
withTrait
Adds the suppliedSCMSourceTrait
.- Parameters:
trait
- the additionalSCMSourceTrait
.- Returns:
this
for method chaining.
-
withTraits
Adds / applies the suppliedSCMTrait
.- Parameters:
traits
- the additionalSCMTrait
instances.- Returns:
this
for method chaining.
-
withTraits
Adds / applies the suppliedSCMTrait
.- Parameters:
traits
- the additionalSCMTrait
instances.- Returns:
this
for method chaining.
-
withDecorator
Adds the suppliedSCMSourceDecorator
.- Parameters:
decorator
- the additionalSCMSourceDecorator
.- Returns:
this
for method chaining.
-
withDecorators
Adds the suppliedSCMSourceDecorator
instances.- Parameters:
decorators
- the additionalSCMSourceDecorator
instances.- Returns:
this
for method chaining.
-
withDecorators
@NonNull public final C withDecorators(@NonNull Collection<? extends SCMSourceDecorator<?, ?>> decorators) Adds the suppliedSCMSourceDecorator
instances.- Parameters:
decorators
- the additionalSCMSourceDecorator
instances.- Returns:
this
for method chaining.
-