Class AdvancedMaterialFactory
java.lang.Object
com.university.bookstore.factory.AdvancedMaterialFactory
Enhanced factory for creating Material instances with advanced validation and type-safe property extraction.
Demonstrates improved Factory pattern implementation with better error handling and validation.
This factory extends the basic MaterialFactory with enhanced validation, type-safe property extraction, and support for complex material configurations.
- Since:
- 2024-09-15
- Version:
- 3.0
- Author:
- Navid Mohaghegh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MaterialcreateMaterial(String type, Map<String, Object> properties) Creates a Material instance based on the specified type and properties.static voidvalidateRequiredProperties(String type, Map<String, Object> properties) Validates that all required properties are present.
-
Constructor Details
-
AdvancedMaterialFactory
public AdvancedMaterialFactory()
-
-
Method Details
-
createMaterial
Creates a Material instance based on the specified type and properties.- Parameters:
type- the material typeproperties- map of properties required for the material- Returns:
- the created Material instance
- Throws:
IllegalArgumentException- if type is null or properties are invalidNullPointerException- if required properties are missing
-
validateRequiredProperties
-