Package jenkins.scm.api.trait
Class SCMSourceTrait
- All Implemented Interfaces:
- ExtensionPoint,- Describable<SCMSourceTrait>
- Direct Known Subclasses:
- RegexSCMHeadFilterTrait,- WildcardSCMHeadFilterTrait
Represents a trait of behaviour or configuration that can be applied to a 
SCMSource.- Since:
- 2.2.0
- 
Nested Class SummaryNested classes/interfaces inherited from interface hudson.ExtensionPointExtensionPoint.LegacyInstancesAreScopedToHudson
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic List<SCMSourceTraitDescriptor>_for(Class<? extends SCMSourceContext> contextClass, Class<? extends SCMBuilder> builderClass) Returns the subset ofSCMSourceTraitDescriptorinstances that are applicable to the specified types ofSCMSourceContextandSCMSourceBuilder.static List<SCMSourceTraitDescriptor>_for(SCMSourceDescriptor scmSource, Class<? extends SCMSourceContext> contextClass, Class<? extends SCMBuilder> builderClass) Returns the subset ofSCMSourceTraitDescriptorinstances that are applicable to the specifiedSCMSourceDescriptorand specified types ofSCMNavigatorContextandSCMSourceBuilder.all()Returns all theSCMSourceTraitDescriptorinstances.final voidapplyToBuilder(SCMBuilder<?, ?> builder) Applies this trait to theSCMBuilder.final voidapplyToContext(SCMSourceContext<?, ?> context) Applies this trait to theSCMSourceContext.final SCMHeadObserverapplyToObserver(SCMHeadObserver observer) Applies this trait to an observer for use during aSCMSourceRequest.protected voiddecorateBuilder(SCMBuilder<?, ?> builder) SPI: Override this method to decorate aSCMBuilder.protected voiddecorateContext(SCMSourceContext<?, ?> context) SPI: Override this method to decorate aSCMSourceContext.protected SCMHeadObserverdecorateObserver(SCMHeadObserver observer) SPI: Override this method to decorate theSCMHeadObserverused during aSCMSourceRequest.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- 
SCMSourceTraitpublic SCMSourceTrait()
 
- 
- 
Method Details- 
applyToContextApplies this trait to theSCMSourceContext.- Parameters:
- context- the context.
 
- 
decorateContextSPI: Override this method to decorate aSCMSourceContext. You can assume that yourSCMSourceTraitDescriptor.isApplicableToContext(Class)istruewithin this method and that the provided context is an instance ofSCMSourceTraitDescriptor.getContextClass().- Parameters:
- context- the context (invariant:- SCMSourceTraitDescriptor.isApplicableToContext(Class)is- trueand- SCMSourceTraitDescriptor.getContextClass()- Class.isInstance(Object)) is- true)
 
- 
applyToObserverApplies this trait to an observer for use during aSCMSourceRequest.- Parameters:
- observer- the observer.
- Returns:
- the supplied observer or a wrapped variant of it.
 
- 
decorateObserverSPI: Override this method to decorate theSCMHeadObserverused during aSCMSourceRequest.- Parameters:
- observer- the observer.
- Returns:
- the supplied observer or a wrapped variant of it.
 
- 
applyToBuilderApplies this trait to theSCMBuilder.- Parameters:
- builder- the builder.
 
- 
decorateBuilderSPI: Override this method to decorate aSCMBuilder. You can assume that yourSCMSourceTraitDescriptor.isApplicableToBuilder(SCMBuilder)istruewithin this method and that the provided builder is an instance ofSCMSourceTraitDescriptor.getBuilderClass().- Parameters:
- builder- the builder (invariant:- SCMSourceTraitDescriptor.isApplicableToBuilder(SCMBuilder)is- trueand- SCMSourceTraitDescriptor.getBuilderClass()- Class.isInstance(Object)) is- true)
 
- 
isCategoryEnabledChecks if the supplied category is required by this trait.- Parameters:
- category- the category.
- Returns:
- trueif this trait requires the supplied category.
 
- 
includeCategorySPI: Override this method to control whether specificSCMHeadCategoryinstances are required.- Parameters:
- category- the category.
- Returns:
- trueto require the category.
 
- 
getDescriptor- Specified by:
- getDescriptorin interface- Describable<SCMSourceTrait>
- Overrides:
- getDescriptorin class- SCMTrait<SCMSourceTrait>
 
- 
allReturns all theSCMSourceTraitDescriptorinstances.- Returns:
- all the SCMSourceTraitDescriptorinstances.
 
- 
_forpublic static List<SCMSourceTraitDescriptor> _for(@CheckForNull Class<? extends SCMSourceContext> contextClass, @CheckForNull Class<? extends SCMBuilder> builderClass) Returns the subset ofSCMSourceTraitDescriptorinstances that are applicable to the specified types ofSCMSourceContextandSCMSourceBuilder.- Parameters:
- contextClass- (optional) type of- SCMSourceContext.
- builderClass- (optional) type of- SCMBuilder.
- Returns:
- the list of matching SCMSourceTraitDescriptorinstances.
 
- 
_forpublic static List<SCMSourceTraitDescriptor> _for(@CheckForNull SCMSourceDescriptor scmSource, @CheckForNull Class<? extends SCMSourceContext> contextClass, @CheckForNull Class<? extends SCMBuilder> builderClass) Returns the subset ofSCMSourceTraitDescriptorinstances that are applicable to the specifiedSCMSourceDescriptorand specified types ofSCMNavigatorContextandSCMSourceBuilder.- Parameters:
- scmSource- (optional)- SCMSourceDescriptor.
- contextClass- (optional) type of- SCMSourceContext.
- builderClass- (optional) type of- SCMBuilder.
- Returns:
- the list of matching SCMSourceTraitDescriptorinstances.
 
 
-