Package jenkins.scm.api.trait
Class SCMTrait<T extends SCMTrait<T>>
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<T>
-
- jenkins.scm.api.trait.SCMTrait<T>
-
- Type Parameters:
T
- the type ofSCMTrait
specialization.
- All Implemented Interfaces:
ExtensionPoint
,Describable<T>
- Direct Known Subclasses:
SCMNavigatorTrait
,SCMSourceTrait
public abstract class SCMTrait<T extends SCMTrait<T>> extends AbstractDescribableImpl<T> implements ExtensionPoint
Base class for common traits.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description SCMTrait()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends SCMTrait<?>>
ArrayList<T>asSetList(Iterable<? extends T> list)
Converts the supplied list ofSCMTrait
instances into a list where there is at most one instance of each trait.static <T extends SCMTrait<?>>
ArrayList<T>asSetList(T first, Iterable<? extends T> list)
Converts the supplied instance and list ofSCMTrait
instances into a list where there is at most one instance of each trait.static <T extends SCMTrait<?>>
Tfind(Iterable<?> traits, Class<T> clazz)
Finds the trait of the required type.SCMTraitDescriptor<T>
getDescriptor()
-
-
-
Method Detail
-
getDescriptor
public SCMTraitDescriptor<T> getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<T extends SCMTrait<T>>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<T extends SCMTrait<T>>
-
asSetList
@NonNull public static <T extends SCMTrait<?>> ArrayList<T> asSetList(@CheckForNull Iterable<? extends T> list)
Converts the supplied list ofSCMTrait
instances into a list where there is at most one instance of each trait.- Type Parameters:
T
- type ofSCMTrait
.- Parameters:
list
- the list to apply the constraint to.- Returns:
- a new list that contains the first instance of any type of trait in the supplied list.
- Since:
- 2.2.0
-
asSetList
public static <T extends SCMTrait<?>> ArrayList<T> asSetList(@NonNull T first, @CheckForNull Iterable<? extends T> list)
Converts the supplied instance and list ofSCMTrait
instances into a list where there is at most one instance of each trait.- Type Parameters:
T
- type ofSCMTrait
.- Parameters:
first
- an entry to prepend to the list (will displace any duplicates in the list)list
- the list to apply the constraint to.- Returns:
- a new list that contains the first instance of any type of trait in the supplied list.
- Since:
- 2.2.0
-
find
@CheckForNull public static <T extends SCMTrait<?>> T find(@NonNull Iterable<?> traits, @NonNull Class<T> clazz)
Finds the trait of the required type.- Type Parameters:
T
- the type of trait.- Parameters:
traits
- the traits to search.clazz
- the type of trait.- Returns:
- the matching trait from the supplied traits or
null
if there is no matching trait. - Since:
- 2.2.0
-
-