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 ofSCMNavigatorContextR- the type ofSCMNavigatorRequestproduced 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
finalorabstractunless there is a documented reason for allowing overrides - All "setter" methods will return
SCMNavigatorContextand 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal List<SCMSourceDecorator<?,?>> Returns the (possibly empty) list ofSCMSourceDecoratorinstances to apply to discovered projects.final List<SCMSourceFilter>filters()Returns the (possibly empty) list ofSCMNavigatorRequestdependent filters.abstract RnewRequest(SCMNavigator navigator, SCMSourceObserver observer) Creates a newSCMNavigatorRequest.final List<SCMSourcePrefilter>Returns the (possibly empty) list ofSCMNavigatorRequestindependent pre-filters.final List<SCMSourceTrait>traits()Returns the (possibly empty) list ofSCMSourceTraitinstances to apply to discovered projects.final CwithDecorator(SCMSourceDecorator<?, ?> decorator) Adds the suppliedSCMSourceDecorator.final CwithDecorators(Collection<? extends SCMSourceDecorator<?, ?>> decorators) Adds the suppliedSCMSourceDecoratorinstances.final CwithDecorators(SCMSourceDecorator<?, ?>... decorators) Adds the suppliedSCMSourceDecoratorinstances.final CwithFilter(SCMSourceFilter filter) Adds the suppliedSCMSourceFilter.final CwithPrefilter(SCMSourcePrefilter prefilter) Adds the suppliedSCMSourcePrefilter.final CwithTrait(SCMNavigatorTrait trait) Applies the suppliedSCMNavigatorTrait.final CwithTrait(SCMSourceTrait trait) Adds the suppliedSCMSourceTrait.final CwithTraits(Collection<? extends SCMTrait<?>> traits) Adds / applies the suppliedSCMTrait.final CwithTraits(SCMTrait<? extends SCMTrait<?>>... traits) Adds / applies the suppliedSCMTrait.
-
Constructor Details
-
SCMNavigatorContext
public SCMNavigatorContext()Constructor.
-
-
Method Details
-
decorators
Returns the (possibly empty) list ofSCMSourceDecoratorinstances to apply to discovered projects.- Returns:
- the (possibly empty) list of
SCMSourceDecoratorinstances to apply to discovered projects.
-
filters
Returns the (possibly empty) list ofSCMNavigatorRequestdependent filters.- Returns:
- the (possibly empty) list of
SCMNavigatorRequestdependent filters.
-
prefilters
Returns the (possibly empty) list ofSCMNavigatorRequestindependent pre-filters.- Returns:
- the (possibly empty) list of
SCMNavigatorRequestindependent pre-filters.
-
traits
Returns the (possibly empty) list ofSCMSourceTraitinstances to apply to discovered projects.- Returns:
- the (possibly empty) list of
SCMSourceTraitinstances to apply to discovered projects.
-
withFilter
Adds the suppliedSCMSourceFilter.- Parameters:
filter- the additionalSCMSourceFilter.- Returns:
thisfor method chaining.
-
withPrefilter
Adds the suppliedSCMSourcePrefilter.- Parameters:
prefilter- the additionalSCMSourcePrefilter.- Returns:
thisfor method chaining.
-
withTrait
Adds the suppliedSCMSourceTrait.- Parameters:
trait- the additionalSCMSourceTrait.- Returns:
thisfor method chaining.
-
withTraits
Adds / applies the suppliedSCMTrait.- Parameters:
traits- the additionalSCMTraitinstances.- Returns:
thisfor method chaining.
-
withTraits
Adds / applies the suppliedSCMTrait.- Parameters:
traits- the additionalSCMTraitinstances.- Returns:
thisfor method chaining.
-
withDecorator
Adds the suppliedSCMSourceDecorator.- Parameters:
decorator- the additionalSCMSourceDecorator.- Returns:
thisfor method chaining.
-
withDecorators
Adds the suppliedSCMSourceDecoratorinstances.- Parameters:
decorators- the additionalSCMSourceDecoratorinstances.- Returns:
thisfor method chaining.
-
withDecorators
@NonNull public final C withDecorators(@NonNull Collection<? extends SCMSourceDecorator<?, ?>> decorators) Adds the suppliedSCMSourceDecoratorinstances.- Parameters:
decorators- the additionalSCMSourceDecoratorinstances.- Returns:
thisfor method chaining.
-