Package jenkins.scm.api.trait
Class SCMNavigatorTrait
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<T>
-
- jenkins.scm.api.trait.SCMTrait<SCMNavigatorTrait>
-
- jenkins.scm.api.trait.SCMNavigatorTrait
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCMNavigatorTrait>
- Direct Known Subclasses:
RegexSCMSourceFilterTrait
,WildcardSCMSourceFilterTrait
public abstract class SCMNavigatorTrait extends SCMTrait<SCMNavigatorTrait>
Represents a trait of behaviour or configuration that can be applied to aSCMSource
.- Since:
- 2.2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description SCMNavigatorTrait()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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
.static DescriptorExtensionList<SCMNavigatorTrait,SCMNavigatorTraitDescriptor>
all()
Returns all theSCMNavigatorTraitDescriptor
instances.void
applyToBuilder(SCMSourceBuilder<?,?> builder)
Applies this trait to theSCMBuilder
.void
applyToContext(SCMNavigatorContext<?,?> context)
Applies this trait to theSCMNavigatorContext
.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
.SCMNavigatorTraitDescriptor
getDescriptor()
protected boolean
includeCategory(SCMHeadCategory category)
SPI: Override this method to control whether specificSCMHeadCategory
instances are required.boolean
isCategoryEnabled(SCMHeadCategory category)
Checks if the supplied category is required by this trait.
-
-
-
Method Detail
-
applyToContext
public final void applyToContext(SCMNavigatorContext<?,?> context)
Applies this trait to theSCMNavigatorContext
.- Parameters:
context
- the context.
-
decorateContext
protected void decorateContext(SCMNavigatorContext<?,?> context)
SPI: Override this method to decorate aSCMNavigatorContext
. You can assume that yourSCMNavigatorTraitDescriptor.isApplicableToContext(Class)
istrue
within this method and that the provided context is an instance ofSCMNavigatorTraitDescriptor.getContextClass()
.- Parameters:
context
- the context (invariant:SCMNavigatorTraitDescriptor.isApplicableToContext(Class)
istrue
andSCMNavigatorTraitDescriptor.getContextClass()
Class.isInstance(Object)
) istrue
)
-
applyToObserver
@NonNull public final SCMSourceObserver applyToObserver(@NonNull SCMSourceObserver observer)
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
@NonNull protected SCMSourceObserver decorateObserver(@NonNull SCMSourceObserver observer)
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
public final void applyToBuilder(SCMSourceBuilder<?,?> builder)
Applies this trait to theSCMBuilder
.- Parameters:
builder
- the builder.
-
decorateBuilder
protected void decorateBuilder(SCMSourceBuilder<?,?> builder)
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
public final boolean isCategoryEnabled(@NonNull SCMHeadCategory category)
Checks if the supplied category is required by this trait.- Parameters:
category
- the category.- Returns:
true
if this trait requires the supplied category.
-
includeCategory
protected boolean includeCategory(@NonNull SCMHeadCategory category)
SPI: Override this method to control whether specificSCMHeadCategory
instances are required.- Parameters:
category
- the category.- Returns:
true
to require the category.
-
getDescriptor
public SCMNavigatorTraitDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<SCMNavigatorTrait>
- Overrides:
getDescriptor
in classSCMTrait<SCMNavigatorTrait>
-
all
public static DescriptorExtensionList<SCMNavigatorTrait,SCMNavigatorTraitDescriptor> 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.
-
_for
public static List<SCMNavigatorTraitDescriptor> _for(@CheckForNull SCMNavigatorDescriptor scmNavigator, @CheckForNull Class<? extends SCMNavigatorContext> contextClass, @CheckForNull Class<? extends SCMSourceBuilder> builderClass)
Returns the subset ofSCMNavigatorTraitDescriptor
instances that are applicable to the specifiedSCMNavigatorDescriptor
and specified types ofSCMNavigatorContext
andSCMSourceBuilder
.- Parameters:
scmNavigator
- (optional)SCMNavigatorDescriptor
.contextClass
- (optional) type ofSCMNavigatorContext
.builderClass
- (optional) type ofSCMSourceBuilder
.- Returns:
- the list of matching
SCMNavigatorTraitDescriptor
instances.
-
-