14 lines
440 B
Java
14 lines
440 B
Java
package abstractfactory;
|
|
|
|
public interface UIFactory {
|
|
|
|
// Factory method for buttons — returns the abstract type, not LightButton or DarkButton
|
|
Button createButton();
|
|
|
|
// Factory method for text fields — same principle
|
|
TextField createTextField();
|
|
|
|
// Adding a new product type (e.g., Checkbox) means adding a method here
|
|
// AND implementing it in every Concrete Factory. This is the one cost of the pattern.
|
|
}
|