Class SCMTrait<T extends SCMTrait<T>>

java.lang.Object
hudson.model.AbstractDescribableImpl<T>
jenkins.scm.api.trait.SCMTrait<T>
Type Parameters:
T - the type of SCMTrait 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.
  • Constructor Details

    • SCMTrait

      public SCMTrait()
  • Method Details

    • getDescriptor

      public SCMTraitDescriptor<T> getDescriptor()
      Specified by:
      getDescriptor in interface Describable<T extends SCMTrait<T>>
      Overrides:
      getDescriptor in class AbstractDescribableImpl<T extends SCMTrait<T>>
    • asSetList

      @NonNull public static <T extends SCMTrait<?>> ArrayList<T> asSetList(@CheckForNull Iterable<? extends T> list)
      Converts the supplied list of SCMTrait instances into a list where there is at most one instance of each trait.
      Type Parameters:
      T - type of SCMTrait.
      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 of SCMTrait instances into a list where there is at most one instance of each trait.
      Type Parameters:
      T - type of SCMTrait.
      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