Class SCMSourceBuilder<B extends SCMSourceBuilder<B,​S>,​S extends SCMSource>

  • Type Parameters:
    B - the type of SCMSourceBuilder so that subclasses can chain correctly in their withTrait(SCMSourceTrait) etc methods.
    S - the type of SCMSource returned by build(). In general this should be a type that has SCMSourceTrait support.

    public abstract class SCMSourceBuilder<B extends SCMSourceBuilder<B,​S>,​S extends SCMSource>
    extends Object
    Builder for a SCMSource instance. Typically instantiated in SCMNavigator.visitSources(SCMSourceObserver) and then decorated by SCMNavigatorTrait.applyToBuilder(SCMSourceBuilder) 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 SCMSourceBuilder 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));
    When applying SCMTrait instances to the builder, the SCMNavigatorTrait instances will modify the builder itself while the SCMSourceTrait instances will be retained to be added to the SCMSource during build()