Class SCMBuilder<B extends SCMBuilder<B,S>,S extends SCM>

java.lang.Object
jenkins.scm.api.trait.SCMBuilder<B,S>
Type Parameters:
B - the type of SCMBuilder so that subclasses can chain correctly in their withHead(SCMHead) etc methods.
S - the type of SCM returned by build()

public abstract class SCMBuilder<B extends SCMBuilder<B,S>,S extends SCM> extends Object
Builder for a SCM instance. Typically instantiated in SCMSource.build(SCMHead, SCMRevision) or SCMSource.build(SCMHead) and then decorated by SCMSourceTrait.applyToBuilder(SCMBuilder) before calling build() to generate the return value. Conventions:
  • The builder is not designed to be shared by multiple threads.
  • All methods should be either final or abstract unless there is a documented reason for allowing overrides
  • All "setter" methods will return SCMBuilder and be called "withXxx"
  • All "getter" methods will be called "xxx()". Callers should not assume that the returned value is resistant from concurrent changes. Implementations should ensure that the returned value is immutable by the caller. In other words, it is intentional for implementations to reduce intermediate allocations by return Collections.unmodifiableList(theList); rather than the concurrency safe return Collections.unmodifiableList(new ArrayList<>(theList));
  • Constructor Details

    • SCMBuilder

      public SCMBuilder(Class<S> clazz, @NonNull SCMHead head, @CheckForNull SCMRevision revision)
      Constructor.
      Parameters:
      clazz - The base class of SCM that will be produced by the SCMBuilder.
      head - The SCMHead to produce the SCM for.
      revision - The SCMRevision to produce the SCM for or null to produce the SCM for the head revision.
  • Method Details