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 Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier 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
-
SCMSourceTrait
public SCMSourceTrait()
-
-
Method Details
-
applyToContext
Applies this trait to theSCMSourceContext.- Parameters:
context- the context.
-
decorateContext
SPI: 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)istrueandSCMSourceTraitDescriptor.getContextClass()Class.isInstance(Object)) istrue)
-
applyToObserver
Applies this trait to an observer for use during aSCMSourceRequest.- Parameters:
observer- the observer.- Returns:
- the supplied observer or a wrapped variant of it.
-
decorateObserver
SPI: Override this method to decorate theSCMHeadObserverused during aSCMSourceRequest.- 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 yourSCMSourceTraitDescriptor.isApplicableToBuilder(SCMBuilder)istruewithin this method and that the provided builder is an instance ofSCMSourceTraitDescriptor.getBuilderClass().- Parameters:
builder- the builder (invariant:SCMSourceTraitDescriptor.isApplicableToBuilder(SCMBuilder)istrueandSCMSourceTraitDescriptor.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<SCMSourceTrait>- Overrides:
getDescriptorin classSCMTrait<SCMSourceTrait>
-
all
Returns all theSCMSourceTraitDescriptorinstances.- Returns:
- all the
SCMSourceTraitDescriptorinstances.
-
_for
public 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 ofSCMSourceContext.builderClass- (optional) type ofSCMBuilder.- Returns:
- the list of matching
SCMSourceTraitDescriptorinstances.
-
_for
public 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 ofSCMSourceContext.builderClass- (optional) type ofSCMBuilder.- Returns:
- the list of matching
SCMSourceTraitDescriptorinstances.
-