Package jenkins.scm.api.trait
Class SCMNavigatorTrait
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCMNavigatorTrait>
- Direct Known Subclasses:
RegexSCMSourceFilterTrait
,WildcardSCMSourceFilterTrait
Represents a trait of behaviour or configuration that can be applied to a
SCMSource
.- Since:
- 2.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<SCMNavigatorTraitDescriptor>
_for
(Class<? extends SCMNavigatorContext> contextClass, Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptor
instances that are applicable to the specified types ofSCMNavigatorContext
andSCMSourceBuilder
.static List<SCMNavigatorTraitDescriptor>
_for
(SCMNavigatorDescriptor scmNavigator, Class<? extends SCMNavigatorContext> contextClass, Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptor
instances that are applicable to the specifiedSCMNavigatorDescriptor
and specified types ofSCMNavigatorContext
andSCMSourceBuilder
.all()
Returns all theSCMNavigatorTraitDescriptor
instances.final void
applyToBuilder
(SCMSourceBuilder<?, ?> builder) Applies this trait to theSCMBuilder
.final void
applyToContext
(SCMNavigatorContext<?, ?> context) Applies this trait to theSCMNavigatorContext
.final SCMSourceObserver
applyToObserver
(SCMSourceObserver observer) Applies this trait to an observer for use during aSCMNavigatorRequest
.protected void
decorateBuilder
(SCMSourceBuilder<?, ?> builder) SPI: Override this method to decorate aSCMBuilder
.protected void
decorateContext
(SCMNavigatorContext<?, ?> context) SPI: Override this method to decorate aSCMNavigatorContext
.protected SCMSourceObserver
decorateObserver
(SCMSourceObserver observer) SPI: Override this method to decorate theSCMSourceObserver
used during aSCMNavigatorRequest
.protected boolean
includeCategory
(SCMHeadCategory category) SPI: Override this method to control whether specificSCMHeadCategory
instances are required.final boolean
isCategoryEnabled
(SCMHeadCategory category) Checks if the supplied category is required by this trait.
-
Constructor Details
-
SCMNavigatorTrait
public SCMNavigatorTrait()
-
-
Method Details
-
applyToObserver
Applies this trait to an observer for use during aSCMNavigatorRequest
.- Parameters:
observer
- the observer.- Returns:
- the supplied observer or a wrapped variant of it.
-
decorateObserver
SPI: Override this method to decorate theSCMSourceObserver
used during aSCMNavigatorRequest
.- Parameters:
observer
- the observer.- Returns:
- the supplied observer or a wrapped variant of it.
-
applyToBuilder
Applies this trait to theSCMBuilder
.- Parameters:
builder
- the builder.
-
decorateBuilder
SPI: Override this method to decorate aSCMBuilder
. You can assume that yourSCMNavigatorTraitDescriptor.isApplicableToBuilder(SCMSourceBuilder)
istrue
within this method and that the provided builder is an instance ofSCMNavigatorTraitDescriptor.getBuilderClass()
.- Parameters:
builder
- the builder (invariant:SCMNavigatorTraitDescriptor.isApplicableToBuilder(SCMSourceBuilder)
istrue
andSCMNavigatorTraitDescriptor.getBuilderClass()
Class.isInstance(Object)
) istrue
)
-
isCategoryEnabled
Checks if the supplied category is required by this trait.- Parameters:
category
- the category.- Returns:
true
if this trait requires the supplied category.
-
includeCategory
SPI: Override this method to control whether specificSCMHeadCategory
instances are required.- Parameters:
category
- the category.- Returns:
true
to require the category.
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<SCMNavigatorTrait>
- Overrides:
getDescriptor
in classSCMTrait<SCMNavigatorTrait>
-
all
Returns all theSCMNavigatorTraitDescriptor
instances.- Returns:
- all the
SCMNavigatorTraitDescriptor
instances.
-
_for
public static List<SCMNavigatorTraitDescriptor> _for(@CheckForNull Class<? extends SCMNavigatorContext> contextClass, @CheckForNull Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptor
instances that are applicable to the specified types ofSCMNavigatorContext
andSCMSourceBuilder
.- Parameters:
contextClass
- (optional) type ofSCMNavigatorContext
.builderClass
- (optional) type ofSCMSourceBuilder
.- Returns:
- the list of matching
SCMNavigatorTraitDescriptor
instances.