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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<SCMNavigatorTraitDescriptor>_for(Class<? extends SCMNavigatorContext> contextClass, Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptorinstances that are applicable to the specified types ofSCMNavigatorContextandSCMSourceBuilder.static List<SCMNavigatorTraitDescriptor>_for(SCMNavigatorDescriptor scmNavigator, Class<? extends SCMNavigatorContext> contextClass, Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptorinstances that are applicable to the specifiedSCMNavigatorDescriptorand specified types ofSCMNavigatorContextandSCMSourceBuilder.all()Returns all theSCMNavigatorTraitDescriptorinstances.final voidapplyToBuilder(SCMSourceBuilder<?, ?> builder) Applies this trait to theSCMBuilder.final voidapplyToContext(SCMNavigatorContext<?, ?> context) Applies this trait to theSCMNavigatorContext.final SCMSourceObserverapplyToObserver(SCMSourceObserver observer) Applies this trait to an observer for use during aSCMNavigatorRequest.protected voiddecorateBuilder(SCMSourceBuilder<?, ?> builder) SPI: Override this method to decorate aSCMBuilder.protected voiddecorateContext(SCMNavigatorContext<?, ?> context) SPI: Override this method to decorate aSCMNavigatorContext.protected SCMSourceObserverdecorateObserver(SCMSourceObserver observer) SPI: Override this method to decorate theSCMSourceObserverused during aSCMNavigatorRequest.protected booleanincludeCategory(SCMHeadCategory category) SPI: Override this method to control whether specificSCMHeadCategoryinstances are required.final booleanisCategoryEnabled(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 theSCMSourceObserverused 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)istruewithin this method and that the provided builder is an instance ofSCMNavigatorTraitDescriptor.getBuilderClass().- Parameters:
builder- the builder (invariant:SCMNavigatorTraitDescriptor.isApplicableToBuilder(SCMSourceBuilder)istrueandSCMNavigatorTraitDescriptor.getBuilderClass()Class.isInstance(Object)) istrue)
-
isCategoryEnabled
Checks if the supplied category is required by this trait.- Parameters:
category- the category.- Returns:
trueif this trait requires the supplied category.
-
includeCategory
SPI: Override this method to control whether specificSCMHeadCategoryinstances are required.- Parameters:
category- the category.- Returns:
trueto require the category.
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<SCMNavigatorTrait>- Overrides:
getDescriptorin classSCMTrait<SCMNavigatorTrait>
-
all
Returns all theSCMNavigatorTraitDescriptorinstances.- Returns:
- all the
SCMNavigatorTraitDescriptorinstances.
-
_for
public static List<SCMNavigatorTraitDescriptor> _for(@CheckForNull Class<? extends SCMNavigatorContext> contextClass, @CheckForNull Class<? extends SCMSourceBuilder> builderClass) Returns the subset ofSCMNavigatorTraitDescriptorinstances that are applicable to the specified types ofSCMNavigatorContextandSCMSourceBuilder.- Parameters:
contextClass- (optional) type ofSCMNavigatorContext.builderClass- (optional) type ofSCMSourceBuilder.- Returns:
- the list of matching
SCMNavigatorTraitDescriptorinstances.