forked from NifTK/NiftyNet
-
Notifications
You must be signed in to change notification settings - Fork 2
The Factory Design Pattern
Alexander B. Powers edited this page Apr 5, 2019
·
5 revisions
All factories appear to be defined in application_factory.py.
This project adheres to the static factory method pattern.
helpful stack overflow
All factories extend the base class of ModuleFactory
src code
class ModuleFactory(object):
"""
General interface for importing a class by its name.
"""
SUPPORTED = None
type_str = 'object'
@classmethod
def create(cls, name):
"""
import a class by name
"""
return select_module(name, cls.type_str, cls.SUPPORTED)
Open this uml png in a new tab for a closer look: