Builder API Documentation
- class Product[source]
Bases:
objectRepresents the complex product being built.
The Product class contains attributes
part_aandpart_b, which represent the individual parts of the product. It provides methods to set these parts and a string representation to display the constructed product.- __init__()[source]
Initializes the Product instance.
Sets the attributes
part_aandpart_bto None, which represent the individual parts of the product.
- class Builder[source]
Bases:
ABCAbstract interface for constructing a Product.
Defines methods for building different parts of a product and retrieving the final constructed result.
- class ConcreteBuilder[source]
Bases:
BuilderConcrete implementation of the Builder interface.
Constructs a specific type of product by implementing the building steps defined in the Builder interface.
- __init__()[source]
Initializes a new instance of the ConcreteBuilder class.
Initializes the builder with a new instance of the Product class.
- build_part_a()[source]
Builds Part A of the product.
Sets Part A to a specific value defined by this builder.
- class Director(builder)[source]
Bases:
objectOrchestrates the construction process.
The Director class uses a Builder to construct a Product in a predefined sequence.
- Parameters:
builder (Builder)