Interface for synchronous builder pattern implementations.
Builders provide a fluent API for constructing complex objects step by step. This interface defines the contract for builders that can complete their construction synchronously.
class SimpleDataBuilder implements Builder<SimpleData> { private data: string = '' setData(data: string): this { this.data = data return this } build(): SimpleData { return new SimpleData(this.data) }}const result = new SimpleDataBuilder() .setData('Hello') .build() Copy
class SimpleDataBuilder implements Builder<SimpleData> { private data: string = '' setData(data: string): this { this.data = data return this } build(): SimpleData { return new SimpleData(this.data) }}const result = new SimpleDataBuilder() .setData('Hello') .build()
The type of object being built
Builds and returns the constructed object.
The constructed object of type T
Interface for synchronous builder pattern implementations.
Builders provide a fluent API for constructing complex objects step by step. This interface defines the contract for builders that can complete their construction synchronously.
Example